You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<boost/core/allocator_access.hpp>
#include<memory>
#include<type_traits>namespaceboost
{
template<classA>
allocator_pointer_t<std::decay_t<A>>
allocator_allocate(A&& a, allocator_size_type_t<std::decay_t<A>> n)
{
returnallocator_allocate(a,n);
}
}
autotester(std::allocator<int> a) {
// feed the rebound allocator directly using the converting constructor//returnboost::allocator_allocate(std::allocator<float>(a),16);
// want to avoid the need to declare `oa` to use the rebound allocator type//// std::allocator<float> oa(a);// return boost::allocator_allocate(oa,16);
}
The text was updated successfully, but these errors were encountered:
Right now most of allocator access takes the allocator by lvalue reference.
I presume this is to support stateful allocators.
Instead, I purport that allocator access should also work with temporarily materialized allocators.
This is useful in the case where we're rebinding a stored allocator and wishing to do a quick one-off allocation in a single place.
The goal is to remove the need to declare a stack-local, for example.
See the relevant CE example here: https://godbolt.org/z/hqKTGb3ab
Obligatory inline copy:
The text was updated successfully, but these errors were encountered: