alignment_of.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. Copyright 2014-2016 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_ALIGNMENT_OF_HPP
  8. #define BOOST_ALIGN_ALIGNMENT_OF_HPP
  9. #include <boost/align/detail/element_type.hpp>
  10. #include <boost/align/alignment_of_forward.hpp>
  11. #if defined(BOOST_MSVC)
  12. #include <boost/align/detail/alignment_of_msvc.hpp>
  13. #elif defined(__GNUC__) && defined(__unix__) && !defined(__LP64__)
  14. #include <boost/align/detail/alignment_of.hpp>
  15. #elif defined(BOOST_CLANG) && !defined(__x86_64__)
  16. #include <boost/align/detail/alignment_of.hpp>
  17. #elif !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
  18. #include <boost/align/detail/alignment_of_cxx11.hpp>
  19. #elif defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600)
  20. #include <boost/align/detail/alignment_of_gcc.hpp>
  21. #elif defined(__CODEGEARC__)
  22. #include <boost/align/detail/alignment_of_codegear.hpp>
  23. #elif defined(BOOST_CLANG)
  24. #include <boost/align/detail/alignment_of_clang.hpp>
  25. #elif __GNUC__ > 4
  26. #include <boost/align/detail/alignment_of_gcc.hpp>
  27. #elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)
  28. #include <boost/align/detail/alignment_of_gcc.hpp>
  29. #else
  30. #include <boost/align/detail/alignment_of.hpp>
  31. #endif
  32. namespace boost {
  33. namespace alignment {
  34. template<class T>
  35. struct alignment_of
  36. : detail::alignment_of<typename
  37. detail::element_type<T>::type>::type { };
  38. #if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
  39. template<class T>
  40. constexpr std::size_t alignment_of_v = alignment_of<T>::value;
  41. #endif
  42. } /* alignment */
  43. } /* boost */
  44. #endif