Boost logo

Boost Users :

From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2004-01-19 05:46:48


Programmer_blabla <Programmer_blabla_at_[hidden]> wrote:
> Ok thank you, I will post this on microsoft.public.vc.language.
>
> About the other thing, I originally thinked about that. But what to
> specifiy, using the typedef's won't work either (see below):
>
> int i;
> boost::tuple<int> data(27);
>
> i = boost::tuples::get<0, boost::tuple<int>::head_type,
> boost::tuple<int>::tail_type>(data); //ok
> i = boost::bind(&boost::tuples::get<0, boost::tuple<int>::head_type,
> boost::tuple<int>::tail_type>, _1)(data); //error
<snip>

Yes, I see, there's ambiguity as to whether this means

    template<int N, class HT, class TT>
    typename access_traits<typename element<N, cons<HT, TT> >::type>
        ::non_const_type
    get(cons<HT, TT> & c);

or

    template<int N, class HT, class TT>
    typename access_traits<typename element<N, cons<HT, TT> >::type>
        ::const_type
    get(const cons<HT, TT> & c);

You can resolve the ambiguity by writing:

    typedef const int & const_int_getter(
        const boost::tuple<int>::inherited &);
    i = boost::bind(static_cast<const_int_getter *>(&boost::get<0>), _1)
        (data);


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