Boost logo

Boost Users :

Subject: [Boost-users] cannot compile boost pmr small_vector snippet
From: Pedro Pinto pedro.pinto_at_[hidden] (pedro.pinto_at_[hidden])
Date: 2019-04-02 10:38:07


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 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