alloc/allocator: add make_allocator convenience function
This commit is contained in:
parent
40cf869d7e
commit
6389839f4e
@ -23,7 +23,7 @@
|
|||||||
// C++11 allocator concept conformant allocator adaptor, going from our
|
// C++11 allocator concept conformant allocator adaptor, going from our
|
||||||
// allocator interface to that of the STL and friends.
|
// allocator interface to that of the STL and friends.
|
||||||
namespace util::alloc {
|
namespace util::alloc {
|
||||||
template <class BackingT, class ValueT>
|
template <typename ValueT, typename BackingT>
|
||||||
class allocator {
|
class allocator {
|
||||||
public:
|
public:
|
||||||
typedef ValueT value_type;
|
typedef ValueT value_type;
|
||||||
@ -54,6 +54,16 @@ namespace util::alloc {
|
|||||||
private:
|
private:
|
||||||
BackingT &m_backing;
|
BackingT &m_backing;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// convenience type-inferring constructor for allocators.
|
||||||
|
template <typename ValueT, typename BackingT>
|
||||||
|
auto
|
||||||
|
make_allocator (BackingT &backing)
|
||||||
|
{
|
||||||
|
return allocator<ValueT,BackingT> (backing);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user