mirror of
https://github.com/boostorg/core.git
synced 2025-07-29 20:37:22 +02:00
Use BOOST_CORE_ALIGNOF in boost/core/max_align.hpp
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#ifndef BOOST_CORE_MAX_ALIGN_HPP_INCLUDED
|
||||
#define BOOST_CORE_MAX_ALIGN_HPP_INCLUDED
|
||||
#ifndef BOOST_CORE_ALIGNOF_HPP_INCLUDED
|
||||
#define BOOST_CORE_ALIGNOF_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
@ -54,4 +54,4 @@ template<class T> struct alignof_helper
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_CORE_MAX_ALIGN_HPP_INCLUDED
|
||||
#endif // #ifndef BOOST_CORE_ALIGNOF_HPP_INCLUDED
|
||||
|
@ -11,6 +11,7 @@
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/alignof.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
@ -73,34 +74,7 @@ union max_align_t
|
||||
void (max_align_t::*pmf)();
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_ALIGNOF)
|
||||
|
||||
BOOST_CONSTEXPR_OR_CONST std::size_t max_align = alignof( max_align_t );
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
BOOST_CONSTEXPR_OR_CONST std::size_t max_align = __alignof__( max_align_t );
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
BOOST_CONSTEXPR_OR_CONST std::size_t max_align = __alignof( max_align_t );
|
||||
|
||||
#else
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
struct alignment_of_helper
|
||||
{
|
||||
char x;
|
||||
max_align_t a;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
BOOST_CONSTEXPR_OR_CONST std::size_t max_align = offsetof( core::detail::alignment_of_helper, a );
|
||||
|
||||
#endif
|
||||
BOOST_CONSTEXPR_OR_CONST std::size_t max_align = BOOST_CORE_ALIGNOF( max_align_t );
|
||||
|
||||
} // namespace core
|
||||
} // namespace boost
|
||||
|
Reference in New Issue
Block a user