Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-07-10 10:44:26


Alexander Nasonov wrote:

> ... and only in there saying:
> ../../../boost/typeof/typeof.hpp(37): error: more than one partial
specialization matches the template argument list of class
"boost::type_of::encode_type_impl<boost::type_of::encode_type_impl<boost::ty
pe_of::detail::push_back<boost::type_of::detail::push_back<boost::mpl::vecto
r0<boost::mpl::void_>, boost::mpl::int_<131093>>::type,
boost::mpl::int_<458770>>::type, const int *const>::type, const int [20]>"
> "boost::type_of::encode_type_impl<V, const T>"
> "boost::type_of::encode_type_impl<V, T [N]>"

Hmmm, do you think this is a compiler bug or a standard behavior? const
int[20] looks to me like an array of const integers, so I would definitely
expect the second specialization envoked, but maybe it's also legal to view
it something like a const integer that happens to be here 20 times? Do you
think similar problems are possible in other contexts?

> I'd suggest to use is_array in combination with mpl::if_:
>
> template<class V, class T> struct encode_type_impl;
> template<class V, class T> struct encode_type_impl_array; // HERE!
> template<class T, class Iter> struct decode_type_impl;
>
> template<class V, class T> struct encode_type
> : boost::mpl::if_<
> ::boost::is_array<T>,
> encode_type_impl_array<V, T>, // AND HERE!
> encode_type_impl<V, T>
> >::type
> {};
>
> Of course, you have to append _array to appropriate specialization of
> encode_type_impl.

#ifdeffed, as a workaround for Intel? Otherwise it may significantly affect
the compile time...

Arkadiy


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