-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flat_map/flat_set with small_vector as container requires explicit allocator-type #120
Comments
Furthermore I came over another problem with custom allocators:
to make the code compile again. |
The container rebind issue seems to be already fix. Thanks |
The problem with rebind are due to the non-type template parameter for the alignment of aligned_allocator: the helper-template for doing the rebind only has specializations for class-type templates. I fixed my problem by replacing the size_t parameter by std::integral_type |
The latest changes to the allocator handling in small_vector now requires that the allocator-type has to be specified explicitely when used with flat_map/set:
This line doesn't compile anymore:
boost::container::flat_map<int, double, std::less, boost::container::small_vector<std::pair<int, double>,17>> my_map;
But this one does:
boost::container::flat_map<int, double, std::less, boost::container::small_vector<std::pair<int, double>,17, boost::container::new_allocator<std::pair<int, double>>>> my_map;
The reason for this is that in container_rebind.hpp:60ff
//Needed for non-conforming compilers like GCC 4.3
template <template <class, std::size_t, class> class Cont, typename V, std::size_t N, typename A, class U>
struct container_rebind<Cont<V, N, A>, U>
{
typedef Cont<U, N, typename allocator_traits::template portable_rebind_alloc::type> type;
};
The template doesn't use the "real_allocator" template to figure out the allocator but uses the small_vector's allocator-default "void".
Tobias
The text was updated successfully, but these errors were encountered: