Skip to content

Initial support for the C++20 modules #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ if(CMAKE_VERSION VERSION_GREATER 3.18 AND CMAKE_GENERATOR MATCHES "Visual Studio

endif()

if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.28.0" AND BUILD_MODULE)
add_subdirectory(module)
endif()

if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")

add_subdirectory(test)
Expand Down
31 changes: 31 additions & 0 deletions include/boost/core/addressof.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Distributed under the Boost Software License, Version 1.0.

#include <boost/config.hpp>

#include <boost/core/detail/module_macro.hpp>

#if defined(BOOST_MSVC_FULL_VER) && BOOST_MSVC_FULL_VER >= 190024215
#define BOOST_CORE_HAS_BUILTIN_ADDRESSOF
#elif defined(BOOST_GCC) && BOOST_GCC >= 70000
Expand All @@ -33,13 +35,17 @@ Distributed under the Boost Software License, Version 1.0.

namespace boost {

BOOST_CORE_BEGIN_MODULE_EXPORT

template<class T>
BOOST_CONSTEXPR inline T*
addressof(T& o) BOOST_NOEXCEPT
{
return __builtin_addressof(o);
}

BOOST_CORE_END_MODULE_EXPORT

} /* boost */
#else
#include <boost/config/workaround.hpp>
Expand Down Expand Up @@ -121,6 +127,8 @@ struct addrof<const volatile addrof_null_t> {
defined(BOOST_NO_CXX11_DECLTYPE)
#define BOOST_CORE_NO_CONSTEXPR_ADDRESSOF

BOOST_CORE_BEGIN_MODULE_EXPORT

template<class T>
BOOST_FORCEINLINE T*
addressof(T& o) BOOST_NOEXCEPT
Expand All @@ -133,6 +141,8 @@ addressof(T& o) BOOST_NOEXCEPT
#endif
}

BOOST_CORE_END_MODULE_EXPORT

#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
namespace detail {

Expand All @@ -143,15 +153,24 @@ struct addrof_result {

} /* detail */


BOOST_CORE_BEGIN_MODULE_EXPORT

template<class T, std::size_t N>
BOOST_FORCEINLINE typename boost::detail::addrof_result<T[N]>::type
addressof(T (&o)[N]) BOOST_NOEXCEPT
{
return &o;
}

BOOST_CORE_END_MODULE_EXPORT

#endif

#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))

BOOST_CORE_BEGIN_MODULE_EXPORT

template<class T, std::size_t N>
BOOST_FORCEINLINE
T (*addressof(T (&o)[N]) BOOST_NOEXCEPT)[N]
Expand All @@ -165,6 +184,9 @@ const T (*addressof(const T (&o)[N]) BOOST_NOEXCEPT)[N]
{
return reinterpret_cast<const T(*)[N]>(&o);
}

BOOST_CORE_END_MODULE_EXPORT

#endif
#else
namespace detail {
Expand Down Expand Up @@ -250,12 +272,17 @@ addressof(T& o) BOOST_NOEXCEPT

} /* detail */

BOOST_CORE_BEGIN_MODULE_EXPORT

template<class T>
constexpr BOOST_FORCEINLINE T*
addressof(T& o) BOOST_NOEXCEPT
{
return boost::detail::addressof(o);
}

BOOST_CORE_END_MODULE_EXPORT

#endif

} /* boost */
Expand All @@ -265,9 +292,13 @@ addressof(T& o) BOOST_NOEXCEPT
!defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
namespace boost {

BOOST_CORE_BEGIN_MODULE_EXPORT

template<class T>
const T* addressof(const T&&) = delete;

BOOST_CORE_END_MODULE_EXPORT

} /* boost */
#endif

Expand Down
6 changes: 6 additions & 0 deletions include/boost/core/alloc_construct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ This functionality is now in <boost/core/allocator_access.hpp>.
*/
#include <boost/core/noinit_adaptor.hpp>

#include <boost/core/detail/module_macro.hpp>

BOOST_CORE_BEGIN_MODULE_EXPORT

namespace boost {

template<class A, class T>
Expand Down Expand Up @@ -92,4 +96,6 @@ alloc_construct_n(A& a, T* p, std::size_t n, I b)

} /* boost */

BOOST_CORE_END_MODULE_EXPORT

#endif
Loading
Loading