- /// \brief Allocate space for an array of objects with the specified alignment
- /// and without constructing them.
- template <typename T> T *Allocate(size_t Num, size_t Alignment) {
- // Round EltSize up to the specified alignment.
- size_t EltSize = (sizeof(T) + Alignment - 1) & (-Alignment);
- return static_cast<T *>(Allocate(Num * EltSize, Alignment));
- }
-
- /// \brief Deallocate space for one object without destroying it.
- template <typename T> void Deallocate(T *Ptr) {
- Deallocate(static_cast<const void *>(Ptr));
- }
-
- /// \brief Allocate space for an array of objects without constructing them.
- template <typename T> void Deallocate(T *Ptr, size_t /*Num*/) {
- Deallocate(static_cast<const void *>(Ptr));
+ /// \brief Deallocate space for a sequence of objects without constructing them.
+ template <typename T>
+ typename std::enable_if<
+ !std::is_same<typename std::remove_cv<T>::type, void>::value, void>::type
+ Deallocate(T *Ptr, size_t Num = 1) {
+ Deallocate(static_cast<const void *>(Ptr), Num * sizeof(T));