|
Boost : |
From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2004-10-17 06:01:25
JOAQUIN LOPEZ MU?Z wrote:
> Hi Tobias,
>
> ----- Mensaje original -----
> De: Tobias Schwinger <tschwinger_at_[hidden]>
> Fecha: Sábado, Octubre 16, 2004 10:24 pm
> Asunto: [boost] Re: [tuple] attempt to fix a BCB regression,and a plea
> for help
>
>
>>Hi,
>>
>>the patch makes tupe_test_bench.cpp compile successfully on BCB
>>5.5.1
>>and 5.6.4.
>
>
> This is great news! Thanks for investigating.
>
>
>>I have to add the disclaimer that it is an intuitive guess and may
>>not
>>be a real solution. I gave it a try, that's all ;+).
>>The code looked good before I touched it and I have honestly no
>>idea why
>>my adjustments make BCB behave again (for both changes)...
>>
>
>
> Umm... This got me thinking, maybe the whole BCB-specific
> patch is just overkill, and it only takes to avoid
> the add_const<> construct.
> The attached file does just this, i.e. it relies on
> the default implementation for element<>, using
> plain const-qualifying instead of add_const<> for
> BCB. Would you be so kind to give it a try? Thanks in
> advance.
>
This new version compiles fine with BCC 5.6.4 but does not compile with
BCC 5.5.1 (and versions below this, according to Boost.Config).
The patch is the difference from the file attached to the post I reply
to (and not the first file you sent) and makes it work again.
It uses the previous workaround in case BOOST_NO_CV_SPECIALIZATIONS is set.
Another check for BCB within this block could be made in order to use
'add_const' for compilers where it works fine (I omitted it, for now).
Here's my (still fuzzy) problem analysis:
1. The "BCC <= 5.5.1 - problem" is that for these versions of BCC
cv-specializations don't work.
2. The "add_const - problem" could have something todo with the fact
that for BCC 'type const' and 'const type' can be different types.
[ see the note regarding the '__BORLANDC__' - block in 'is_const.hpp' ]
I am not sure if and how this affects template argument substitution,
but I changed
typename T::head_type const
to
const typename T::head_type
, just in case...
Regards,
Tobias
137a138,139
> #ifndef BOOST_NO_CV_SPECIALIZATIONS
>
159,160c161,162
< #if defined(__BORLANDC__)
< typedef unqualified_type const type;
--- > #if defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) > typedef const unqualified_type type; 169,170c171,172 < #if defined(__BORLANDC__) < typedef typename T::head_type const type; --- > #if defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) > typedef const typename T::head_type type; 174a177,222 > > #else // def BOOST_NO_CV_SPECIALIZATIONS > > namespace detail { > > template<int N, class T, bool IsConst> > struct element_impl > { > private: > typedef typename T::tail_type Next; > public: > typedef typename element_impl<N-1, Next, IsConst>::type type; > }; > > template<int N, class T> > struct element_impl<N, T, true /* IsConst */> > { > private: > typedef typename T::tail_type Next; > public: > typedef const typename element_impl<N-1, Next, true>::type type; > }; > > template<class T> > struct element_impl<0, T, false /* IsConst */> > { > typedef typename T::head_type type; > }; > > template<class T> > struct element_impl<0, T, true /* IsConst */> > { > typedef const typename T::head_type type; > }; > > } // end of namespace detail > > > template<int N, class T> > struct element: > public detail::element_impl<N, T, ::boost::is_const<T>::value> > { > }; > > #endif >
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk