alignment_of.hpp 1.6 KB

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