alignment_of.hpp 597 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_DETAIL_ALIGNMENT_OF_HPP
  8. #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_HPP
  9. #include <boost/align/detail/min_size.hpp>
  10. namespace boost {
  11. namespace alignment {
  12. namespace detail {
  13. template<class T>
  14. struct offset_value {
  15. char value;
  16. T object;
  17. };
  18. template<class T>
  19. struct alignment_of
  20. : min_size<sizeof(T), sizeof(offset_value<T>) - sizeof(T)> { };
  21. } /* detail */
  22. } /* alignment */
  23. } /* boost */
  24. #endif