Boost logo

Boost :

From: Rani Sharoni (rani_sharoni_at_[hidden])
Date: 2003-02-18 12:58:04


Peter Dimov wrote:
> Rani Sharoni wrote:
>>
>> You can probably use a similar approach to implement yet another
>> is_class (not void, reference and doesn't have an implicit standard
>> conversion to bool).
>
> I wonder whether "int () const" has an implicit standard conversion
> to bool. ;-)
Good catch.

According to 8.3.5/7 - A typedef of a function type whose declarator
includes a cv-qualifier-seq shall be used only to declare the function type
for a nonstatic member function, to declare the function type to which a
pointer to member refers, or to declare the top level function type of
another function typedef declaration.
This means that you can't take a reference or pointer to such types and
therefore such types will fail all the is_function implemetations I know
about (and few other traits like is_convertible).

typedef int ftype() const;

template<typename T>
char *f(T*);

template<typename T>
long *f(...);

long *p = f<ftype>(0); // Failed to compile using EDG 3.0.1 and GCC3.2

I think that this case should fall under SFINAE and it might worth a DR.

Rani


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