Boost logo

Boost :

From: Gennadiy E. Rozental (rogeeff_at_[hidden])
Date: 2001-08-28 16:07:45


I don't think it's possible. How dare Sun state that thay provide
partial specialization @!#$@#$$@#$@##@$!!

Example program:

#include <iostream>
#include <typeinfo.h>

template<typename T>
struct A {
    typedef T type;
};

template<typename T>
struct A<T*> {
    typedef T type;
};

int
main()
{
    std::cout << typeid( A<int*>::type ).name() << std::endl;

    return 0;
}

Output:
int*

The same with <T&> specilization or <T[n]> specialization.

Gennadiy.

P.S. For those who want to laugh I can provide another funny example

#include <iostream>
#include <boost/type_traits/composite_traits.hpp>

template <bool base> struct A {};

template <typename T>
struct is_empty
{
   typedef ::A<boost::type_traits::ice_not<
       ::boost::is_reference<char*>::value>::value
> a;
public:
};

int
main()
{
    std :: cout << boost::is_pointer<int*>::value << std::endl;
}

The code before main absolutely unrelated to what main is doing.

Now when you compile and run it you will get .... 0.

Want to know what you need to do to fix it? Very simple fix:
put ::boost::is_reference<char*>::value>::value onto the same line as
typedef. Compile and run it you will get .... 1. Oops. Difference -
carriage return simbol in a code.

--- In boost_at_y..., Jeremy Siek <jsiek_at_c...> wrote:
>
> Ok, I've checked in this change.
>
> BTW, since Sun 6.x supports partial specialization, we might think
about
> providing our own std::iterator_traits implementation as a temporary
> workaround on this compiler. Sun's headers have an implementation of
> iterator_traits, but they have it ifdef'd out :(
>
> On Tue, 28 Aug 2001, Gennadiy E. Rozental wrote:
> rogeef> Hi,
> rogeef>
> rogeef> on Sun workshop property_map_cc does not compile without
following fix
> rogeef>
> rogeef> RCS
file: /cvsroot/boost/boost/libs/property_map/property_map_cc.cpp,v
> rogeef> retrieving revision 1.3
> rogeef> diff -r1.3 property_map_cc.cpp
> rogeef> 64c64,68
> rogeef> < typedef iterator_property_map<Iterator, IndexMap>
PMap;
> rogeef> ---
> rogeef> > typedef iterator_property_map<Iterator, IndexMap
> rogeef> > #ifdef BOOST_NO_STD_ITERATOR_TRAITS
> rogeef> > , Value, const Value&
> rogeef> > #endif
> rogeef> > > PMap;
> rogeef> 72c76,80
> rogeef> < typedef iterator_property_map<Iterator, IndexMap>
PMap;
> rogeef> ---
> rogeef> > typedef iterator_property_map<Iterator, IndexMap
> rogeef> > #ifdef BOOST_NO_STD_ITERATOR_TRAITS
> rogeef> > , Value, Value&
> rogeef> > #endif
> rogeef> > > PMap;
> rogeef>
> rogeef> I propose this change to be accepted.
> rogeef>
> rogeef> Gennadiy
> rogeef>
> rogeef>
> rogeef>
> rogeef> Info: http://www.boost.org Unsubscribe: <mailto:boost-
unsubscribe_at_y...>
> rogeef>
> rogeef> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> rogeef>
> rogeef>
> rogeef>
>
> --------------------------------------------------------------------

--
>  Jeremy Siek                          http://php.indiana.edu/~jsiek/
>  Ph.D. Student, Indiana Univ. B'ton   email: jsiek_at_c...
>  C++ Booster (http://www.boost.org)   office phone: (812) 855-9761
> --------------------------------------------------------------------
--

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