Boost logo

Boost :

From: Tom Lahoda (tlahoda_at_[hidden])
Date: 2007-03-30 10:27:45


Your foo struct only has one template argument

On 3/30/07, Daniel Walker <daniel.j.walker_at_[hidden]> wrote:
>
> Hello,
>
> I've been looking into getting member template detection to work on
> various compilers, and I have a question regarding SFINAE. I hope
> someone can help. All the compilers I've tried reject the following.
>
> template<class T>
> struct foo {};
>
> template<class T, class U>
> void f(T,U) {}
>
> template<class T, class U>
> void f(foo<T,U>) {} // error: wrong number of template
> // arguments (2, should be 1) provided for
> // 'template<class T> struct foo'
>
> template<class T, class U>
> struct bar {};
>
> template<class T, class U>
> struct bar<foo<T,U>, U> {}; // error: wrong number of template
> // arguments (2, should be 1) provided for
> // 'template<class T> struct foo'
>
> int main()
> {
> f(0,0);
> typedef bar<int,int> type;
> }
>
> Is this a substitution failure? Should the 2nd overload of f() be
> removed from the set of candidate functions during overload
> resolution? Should something similar be true for the partial
> specialization of bar<>? Or is this standard compliant behavior?
>
> I've worked out pretty much every other issue, but I don't think I can
> get this one to work if this is a compiler bug.
>
> Thanks.
> Daniel
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk