cannot compile boost pmr small_vector snippet

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

cannot compile boost pmr small_vector snippet

Boost - Users mailing list
Hi there, I am trying to use the pmr version of the boost small_vector container. I expected the following to work:

#include <boost/container/pmr/polymorphic_allocator.hpp>
#include <boost/container/pmr/small_vector.hpp>

boost::container::pmr::polymorphic_allocator<int> alloc;
boost::container::pmr::small_vector<int,4> vec(alloc);
But this does not compile with boost 65, gcc 7.3/clang 6.0. The compile error seems to suggest I should be using small_vector_allocator which is an internal class. The exact clang error is below. Am I missing something here? Thanks

/usr/include/boost/container/small_vector.hpp:514:41: note: candidate constructor not viable: no known conversion from 'boost::container::pmr::polymorphic_allocator<int>' to 'const boost::container::small_vector<int, 4, boost::container::pmr::polymorphic_allocator<int> >::allocator_type' (aka 'const small_vector_allocator<boost::container::pmr::polymorphic_allocator<int> >') for 1st argument 
BOOST_CONTAINER_FORCEINLINE explicit small_vector(const allocator_type &a)

Boost-users mailing list
[hidden email]