Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-05 00:57:41


Granted, Aleksey, but the case in question can be handled without remove_cv,
as I've illustrated. No need for workarounds (at least not these ones ;-)).

-Dave

----- Original Message -----
From: "Aleksey Gurtovoy" <alexy_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, March 04, 2001 11:51 PM
Subject: RE: [boost] Re: FW: converting shared_ptr<const T> to shared_ptr<
T>

> David Abrahams wrote:
> > No, because remove_cv<> doesn't work without partial
> > specialization.
>
> Strictly speaking, that's true; I just wanted to note that the latest
> version of the 'type traits' library (in CVS) makes the above assertion
not
> so flat. From the library documentation:
>
> ...support for partial specialization of class templates is required to
> correctly implement the type transformation templates. On the other hand,
> practice shows that many of the templates from this category are very
> useful, and often essential for implementing some generic libraries. Lack
of
> these templates is often one of the major limiting factors in porting
those
> libraries to compilers that do not yet support this language feature. As
> some of these compilers are going to be around for a while, and at least
one
> of them is very wide-spread, it was decided that the library should
provide
> workarounds where possible. The basic idea behind the workaround is
>
> 1. To manually define full specializations of all type transformation
> templates for all fundamental types, and all their 1st and 2nd rank
> cv-[un]qualified derivative pointer types, and to
> 2. Provide a user-level macro that will define such explicit
specializations
> for any user-defined type T.
>
> The first part guarantees the successful compilation of something like
this:
>
> BOOST_STATIC_ASSERT((is_same<char,
remove_reference<char&>::type>::value));
> ...
> BOOST_STATIC_ASSERT((is_same<char const volatile* const volatile* const
> volatile, remove_reference<char const volatile* const volatile* const
> volatile&>::type>::value));
>
> and the second part provides library's users with a mechanism to make the
> above code work not only for 'char', 'int' or other built-in type, but for
> they own types too:
>
> struct my {};
> BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(my)
> BOOST_STATIC_ASSERT((is_same<my, remove_reference<my&>::type>::value));
> BOOST_STATIC_ASSERT((is_same<my, remove_const<my const>::type>::value));
> // etc.
>
> Note that the maco BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION
> evaluates to nothing on those compilers that do support partial
> specialisation.
>
>
> Aleksey
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


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