diff --git a/alloc/allocator.hpp b/alloc/allocator.hpp index c842e25b..9d066cbc 100644 --- a/alloc/allocator.hpp +++ b/alloc/allocator.hpp @@ -11,16 +11,17 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2015 Danny Robson + * Copyright 2015-2018 Danny Robson */ -#ifndef __UTIL_ALLOC_ALLOCATOR_HPP -#define __UTIL_ALLOC_ALLOCATOR_HPP +#pragma once + +#include "../view.hpp" #include #include -// C++11 allocator concept conformant allocator adaptor, going from our +// C++11 allocator concept conformant(ish) allocator adaptor, going from our // allocator interface to that of the STL and friends. namespace util::alloc { template @@ -35,12 +36,18 @@ namespace util::alloc { { ; } - ValueT* + util::view allocate (size_t count) { - return reinterpret_cast ( - m_backing.template allocate (sizeof (ValueT) * count) - ); + return { + reinterpret_cast ( + m_backing.template allocate ( + sizeof (ValueT) * count, + alignof (ValueT) + ) + ), + count + }; } @@ -65,5 +72,3 @@ namespace util::alloc { return allocator (backing); } } - -#endif