Closed vinniefalco closed 3 years ago
This specialization of boost::container::uses_allocator:
boost::container::uses_allocator
template<class T> struct uses_allocator< ::boost::json::value, json::polymorphic_allocator<T>> : std::true_type { };
fails, because Boost.Container does not use remove_cvref on the allocator. This causes uses_allocator to receive json::polymorphic_allocator<T>&
remove_cvref
uses_allocator
json::polymorphic_allocator<T>&
However if I use this workaround:
template<class T> struct uses_allocator< ::boost::json::value, json::polymorphic_allocator<T>& > // <---- note the reference : std::true_type { };
it works correctly. The problem is here (and is likely in other places). I believe remove_cvref_t<ArgAlloc> is needed: https://github.com/boostorg/container/blob/5a52472cd00994bf1752e92c1c178a5a822a36cb/include/boost/container/detail/dispatch_uses_allocator.hpp#L116
remove_cvref_t<ArgAlloc>
Thanks for the report!
This specialization of
boost::container::uses_allocator
:fails, because Boost.Container does not use
remove_cvref
on the allocator. This causesuses_allocator
to receivejson::polymorphic_allocator<T>&
However if I use this workaround:
it works correctly. The problem is here (and is likely in other places). I believe
remove_cvref_t<ArgAlloc>
is needed: https://github.com/boostorg/container/blob/5a52472cd00994bf1752e92c1c178a5a822a36cb/include/boost/container/detail/dispatch_uses_allocator.hpp#L116