Boost logo

Boost Users :

Subject: Re: [Boost-users] [container][flat_map] Internal storage for flat_maps / flat_sets
From: Klaim - Joël Lamotte (mjklaim_at_[hidden])
Date: 2014-09-13 05:07:47


AFAIK, flat_* containers are really a std::vector disguised (wrapped) as a
std::map or std::set.
Basically I assume that you are correct.
You can even manipulate manually the vector content if you want, as long as
you keep the invariants valid (for example, keep the elements in sorted
order).

On Sat, Sep 13, 2014 at 11:00 AM, Aaron Levy <aaron.levy_at_[hidden]> wrote:

> What is the type of the underlying contiguous storage used by the flat_map
> / flat_set containers? Does the following code make sense:
>
> flat_map<T> container;
> ...
> if (container.size() > 0) {
> const T& elem = *(container.begin());
> const T& elem_1 = *(container.begin() + 1);
> assert(&elem_1 == &elem + 1);
> }
>
> Aaron
> _______________________________________________
> 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