2
0
mirror of https://github.com/boostorg/align.git synced 2026-01-23 17:22:08 +00:00
Files
align/example/aligned_ptr.hpp
2014-06-11 07:05:18 -07:00

28 lines
539 B
C++

/*
Copyright (c) 2014 Glen Joseph Fernandes
glenfe at live dot com
Distributed under the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt
or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef ALIGNED_PTR_HPP
#define ALIGNED_PTR_HPP
#include <boost/align.hpp>
#include <memory>
template<class T>
struct aligned_delete {
void operator()(T* ptr) {
ptr->~T();
boost::aligned_free(ptr);
}
};
template<class T>
using aligned_ptr = std::unique_ptr<T,
aligned_delete<T> >;
#endif