Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-12-14 13:40:00


Now I have a question regarding iteration through the map. Would you expect this sample to work:

        typedef mpl::map
                        <
                                mpl::pair<int, int>
                        , mpl::pair<int, double>
                        , mpl::pair<int, char[20]>
                        , mpl::pair<int, char>
> seq_t;

        typedef mpl::begin<seq_t>::type begin_map;
        typedef mpl::apply
                <
                        mpl::insert<mpl::_1, mpl::_2>
                        , mpl::vector<>
                        , begin_map
>::type vector_with_one_elem;

It fails with 147 compilation errors.

Top errors look like:

c:\boost\include\boost-1_33_1\boost\mpl\aux_\preprocessed\plain\reverse_fold_impl.hpp(203) : error
C2039: 'type' : is not a member of 'boost::mpl::next<T>'
        with
        [
            T=boost::mpl::m_iter<seq_t,6,6>
        ]
        c:\boost\include\boost-1_33_1\boost\mpl\aux_\preprocessed\plain\reverse_fold_impl.hpp(212)
: see reference to class template instantiation
'boost::mpl::aux::reverse_fold_impl<N,First,Last,State,BackwardOp,ForwardOp>' being
compiled
        with
        [
            N=-1,
            First=boost::mpl::m_iter<seq_t,6,6>,
            Last=boost::mpl::v_iter<boost::mpl::vector0<boost::mpl::na>,0>,
            State=boost::mpl::vector0<boost::mpl::na>,
            BackwardOp=boost::mpl::push_front<boost::mpl::_,boost::mpl::_>,
            ForwardOp=boost::mpl::arg<1>
        ]

Thanks a lot for your help!

Ovanes

On Thu, December 14, 2006 19:12, Ovanes Markarian wrote:
> But my question would be: Would you see an advantage in this approach (with type derivation)? On
> the other hand, if I could manipulate the types the same way in mpl::vector and mpl::map this
> would be more clearer. I think vector should not support the derived types as well.
>
>
> With Kind Regards,
>
> Ovanes Markarian
>
>
> On Thu, December 14, 2006 19:04, David Abrahams wrote:
>> "Ovanes Markarian" <om_boost_at_[hidden]> writes:
>>
>>> I believe I found some problem, when I was writing the test cases ;) It is for sure responsible
>>> for the reported misbehavior with max_element.
>>>
>>>
>>> Well, I don't know how to deal with this issue, may be you can
>>> advice smth. Map accepts sequence of type pair. Vector as well. My
>>> approach was to think, as long as mpl::pair static interface (first,
>>> second) is valid I can use another class as well.
>>
>> Clearly from your experiments you can see that you can't actually do
>> that.
>>
>> --
>> Dave Abrahams
>> Boost Consulting
>> www.boost-consulting.com
>>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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