Boost logo

Boost :

Subject: Re: [boost] is_range metafunction
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2008-10-06 07:02:42


Mathias Gaunard a écrit :
> As of today, in GCC 4.4, you can do something equivalent but have to be
> significantly more verbose:
>
> template<typename T, size_t Cond>
> struct foo_type
> {
> typedef decltype(((T*)0)->foo()) type;
> };
>
> template<typename T>
> typename foo_type<T, sizeof(((T*)0)->foo() > 0)>::type foo(T&& t)
> {
> return t.foo();
> }
>
> (You cannot put decltype directly in the return type because of name
> mangling issues)

Can't this be packaged into some macro like BOOST_HAS_XXX ?


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