Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-12-10 13:29:22


"Reece Dunn" <msclrhd_at_[hidden]> writes:

> David Abrahams wrote:
>
>>"John Maddock" <john_at_[hidden]> writes:
>
>> >> [3] When using BOOST_DEDUCED_TYPENAME, should it be used in all
>> contexts
>> >> other than in template parameters, e.g.
>
>> >> template< typename T > // ok
>> >> struct demo
>> >> {
>> >> typedef BOOST_DEDUCED_TYPENAME T::type type;
>> >> typedef std::list< BOOST_DEDUCED_TYPENAME T::value_type > list;
>> >> };
>
>> > No, probably only in deduced contexts - see the test program for
>> that macro
>> > for an example.
>
>>Actually on compilers where it's needed, it seems to be safe (and
>>occasionally neccessary) to use it everywhere except in the place
>>labelled OK above. We really ought to change it to BOOST_TYPENAME.
>
> I think the name should be kept - it is already in use, so changing it
> may break a lot of code.

"Obviously" we'd change the code using it too, or we'd just

#define BOOST_DEDUCED_TYPENAME BOOST_TYPENAME

as a transition measure.

> Also, the name indicates the use of typename
> in the
> BOOST_DEDUCED_TYPENAME T::type type
> context, signifying meaning.

My point is that it gets used in lots of other contexts than deduced
ones. I use it all over my code anytime vc6/7 or BCC complain about a
legal use of typename, which happens in all sorts of places. I use it
because it's more convenient than trying to come up with something
that is set in exactly the same circumstances.

>>( this might be another reason to write template<class T> ;-> )
>
> Here would be a good use for a BOOST_TYPENAME, that becomes typename
> for compilers that support it, and class for those that don't.

Sorry, but AFAICT that would be silly. All compilers support
"typename" in that context.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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