Aleksey Gurtovoy <[EMAIL PROTECTED]> writes:

> Peter Dimov wrote:
>> I wrote "I don't understand how it works even _after_ (briefly) 
>> looking at the code. ;-)" but then it occured to me that list(int, char, 
>> long, int) is a function type. 
>
> Yep.
>
>> Cool trick. Cv qualifiers will probably be a problem 
>
> They are stripped on non-class rvalues, aren't they? :(. So, basically, this
> one will work:
>
>     typedef eval<
>           count_if(
>               list(int,char,long,her const)
>             , lambda(is_same(_,her const))
>             )
>         >::type res;
>
>     BOOST_STATIC_ASSERT(res::value == 1);
>
> but this one won't:
>
>     typedef eval<
>           count_if(
>               list(int,char,long,int const)
>             , lambda(is_same(_,int const))
>             )
>         >::type res;
>
>     BOOST_STATIC_ASSERT(res::value == 1); // error, res::value == 2

Actually I think they're stripped in function argument lists
for classes as well.

    struct X {};
    void f(X const) {}
    void (&g)(X) = f; // proof

    // really prove it's not just a conversion
    template <class T, class U> struct same;
    template <class T> struct same<T,T> {};

    template <class T, class U>
    int cksame(T&,U&)
    {
       same<T,U> z;
       return 0;
    }

    int z = cksame(f,g);


> P.S. It just occured to me that with the above we finally have a way
> to write two nested template instantiations without a space between
> their closing brackets:
>   
>    typedef one<another<int> > == typedef eval< one(another(int)) >::type

Sort of. They're not templates anymore are they?

> That one would really make a good 

...or EVIL!...

> obfuscated contest's task :).

This is too funny.
-- 
                       David Abrahams
   [EMAIL PROTECTED] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to