aligned_delete.hpp 671 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. Copyright 2014-2015 Glen Joseph Fernandes
  3. (glenjofe@gmail.com)
  4. Distributed under the Boost Software License, Version 1.0.
  5. (http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #ifndef BOOST_ALIGN_ALIGNED_DELETE_HPP
  8. #define BOOST_ALIGN_ALIGNED_DELETE_HPP
  9. #include <boost/align/aligned_alloc.hpp>
  10. #include <boost/align/aligned_delete_forward.hpp>
  11. namespace boost {
  12. namespace alignment {
  13. struct aligned_delete {
  14. template<class T>
  15. void operator()(T* ptr) const
  16. BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(ptr->~T())) {
  17. if (ptr) {
  18. ptr->~T();
  19. boost::alignment::aligned_free(ptr);
  20. }
  21. }
  22. };
  23. } /* alignment */
  24. } /* boost */
  25. #endif