|
Boost Users : |
From: Andy Little (andy_at_[hidden])
Date: 2006-09-07 06:49:56
<imre_at_[hidden]> wrote in message
news:20060907060211.DFA9D1054D4_at_wowbagger.osl.iu.edu...
> Hi,
>
> I am getting this error message, when using boost::tuple:
>
> include\boost\tuple\detail\tuple_basic.hpp(373) : error C2039: 'tail' : is
> not a member of 'boost::tuples::cons<HT,TT>'
> 1> with
> 1> [
> 1> HT=UTX::DB::nulled_type<unsigned char>,
> 1> TT=boost::tuples::null_type
> 1> ]
>
> The referred line is the templated constructor of the non-specialised struct
> cons:
>
> template <class HT2, class TT2>
> cons( const cons<HT2, TT2>& u ) : head(u.head), tail(u.tail) {}
>
> So it seems that somehow the non-specialised method is called for the
> specialised template instantiation. Has anybody seen something like this?
Yes.
> Is there a way to circumvent it?
With me it happened because the compiler was instantiating (unintended) stuff
where the tuple was too short.
You could try using enable_if on a very general signature instead of
specialisation to prevent the compiler 'looking into' stuff. IOW
Before:
template <int N> struct my;
template <> struct my<1>{...};
After:
template <int N, typename Enable = void> struct my; // <--- for boost::enable_if
template <int N>
struct my <N, typename boost::enable_if_c<(N==1) >::type> {...};
HTH
regards
Andy Little
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net