From 6389839f4e46a7fb4e3f2e32784bfd7d4d8a7713 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 9 Apr 2018 18:33:12 +1000 Subject: [PATCH] alloc/allocator: add make_allocator convenience function --- alloc/allocator.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/alloc/allocator.hpp b/alloc/allocator.hpp index c1cc37d3..c842e25b 100644 --- a/alloc/allocator.hpp +++ b/alloc/allocator.hpp @@ -23,7 +23,7 @@ // C++11 allocator concept conformant allocator adaptor, going from our // allocator interface to that of the STL and friends. namespace util::alloc { - template + template class allocator { public: typedef ValueT value_type; @@ -54,6 +54,16 @@ namespace util::alloc { private: BackingT &m_backing; }; + + + /////////////////////////////////////////////////////////////////////////// + // convenience type-inferring constructor for allocators. + template + auto + make_allocator (BackingT &backing) + { + return allocator (backing); + } } #endif