Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2006-04-30 05:50:39


> On my VC 8.0 I've successfully rewrote "is_reference"
> implementation (from is_reference.hpp)

> down to the following:

The code you're looking at is used for *broken compiler only*. Please
google back through the mailing list to find out why it was done that way
(basically "it worked").

For conforming compilers it's all handled in the two lines of code:

BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_reference,T,false)
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(typename T,is_reference,T&,true)

Which uses partial specialisation.

> I understand original code - but it uses
> "is_reference_helper1" and "is_reference_helper2" for the same
> thing - ie to distingwish between fn pointer size and char size but
> this could be done in "one pass" (see my is_ref_fn(..) above)
>
> also why to compare against fn ptr type and char type when we
> can compare against 'T' type reference (sizeof(T&) >= 4) and
> char (sizeof(char) == 1) (see my code)

No sizeof(T&) can be 1, for example sizeof(char&) is 1.

John.


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