Boost logo

Boost Users :

Subject: Re: [Boost-users] [mpl] Working with map, copy and back_inserter
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2017-02-05 20:40:37


AMDG

On 02/05/2017 02:42 AM, ☂Josh Chia (謝任中) wrote:
> <snip>
> The essence of the problem is that my attempt to construct/build my keys
> using copy with back_inserter does not give me a mpl::vector<> of
> mpl::size_t<> that is_same to Count, the expected value. It does give me a
> sequence, and the elements have the right value and value_type but they are
> not is_same to the expected size_t<> types. So, if I use the elements
> together with the size_t<> in an mpl::map, won't they be considered to be
> different keys?
>

Yes. If you want to use a map this way, you'll
need to normalize the keys for insertion.

something like this should do the trick:

template<class T>
struct as_size_t { typedef mpl::size_t<T::value> type; };

In Christ,
Steven Watanabe


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