octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: mx_inlines simplifications


From: Michael Goffioul
Subject: Re: FYI: mx_inlines simplifications
Date: Sat, 27 Feb 2010 16:54:42 +0000

On Fri, Feb 26, 2010 at 9:27 AM, Michael Goffioul
<address@hidden> wrote:
> On Fri, Feb 26, 2010 at 8:48 AM, Jaroslav Hajek <address@hidden> wrote:
>> hi all,
>>
>> based on the previous simplifications of the Array class hierarchy, I
>> was finally able to simplify the appliers in mx-inlines:
>> http://hg.savannah.gnu.org/hgweb/octave/rev/b47ab50a6aa8
>>
>> All the appliers are now parametrized directly by value types instead
>> of array types, and are accepting & returning generic Arrays.
>> The code is now much cleaner and no longer cluttered by the AELEMT
>> macro. Also, there should be less distinct instances in total now,
>> so maybe the compiler could merge some of them.
>>
>> Michael, I believe this could solve some of your compilation problems
>> with MSVC, because the function template parameter in do_mx_unary_map
>> no longer contains dependent names:
>>
>> template <class R, class X, R fun (X)>
>> inline Array<R>
>> do_mx_unary_map (const Array<X>& x)
>>
>> template <class R, class X, R fun (const X&)>
>> inline Array<R>
>> do_mx_unary_map (const Array<X>& x)
>>
>> IIRC, according to your tests MSVC handled this simpler case
>> correctly. Can you confirm...?
>
> Thanks Jaroslav. I'll give it a try asap (might take a few days, though,
> I can only do this in the evening). It should indeed work, but you never
> know with MSVC... ;)

Unfortunately, it still doesn't compile with MSVC. I tried to narrow down
the problem and posted a question on MSDN forum. See
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/736cd53c-a392-4535-8e48-e633e11e6973
for reference. It seems that MSVC cannot cope with 2 similar template
definitions using function template parameters with different argument
passing convention (one with "R fun(X)" and the other with "R fun(const X& x)").
It looks like it's trying to instantiate both and always fail on one of them:

- "float abs(float)" cannot be applied to "R fun(const X&)"
- "float abs(const std::complex<float>&)" cannot be applied to "R fun(X)"

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]