整理
This commit is contained in:
102
include/boost/scope/detail/compact_storage.hpp
Normal file
102
include/boost/scope/detail/compact_storage.hpp
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2022 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/compact_storage.hpp
|
||||
*
|
||||
* This header contains utility helpers for implementing compact storage
|
||||
* for class members. In particular, it allows to leverage empty base optimization (EBO).
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_COMPACT_STORAGE_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_COMPACT_STORAGE_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
#include <boost/scope/detail/type_traits/is_final.hpp>
|
||||
#include <boost/scope/detail/type_traits/negation.hpp>
|
||||
#include <boost/scope/detail/type_traits/conjunction.hpp>
|
||||
#include <boost/scope/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
//! The class allows to place data members in the tail padding of type \a T if the user's class derives from it
|
||||
template<
|
||||
typename T,
|
||||
typename Tag = void,
|
||||
bool = detail::conjunction< std::is_class< T >, detail::negation< detail::is_final< T > > >::value
|
||||
>
|
||||
class compact_storage :
|
||||
private T
|
||||
{
|
||||
public:
|
||||
template< typename... Args >
|
||||
constexpr compact_storage(Args&&... args) noexcept(std::is_nothrow_constructible< T, Args... >::value) :
|
||||
T(static_cast< Args&& >(args)...)
|
||||
{
|
||||
}
|
||||
|
||||
compact_storage(compact_storage&&) = default;
|
||||
compact_storage& operator= (compact_storage&&) = default;
|
||||
|
||||
compact_storage(compact_storage const&) = default;
|
||||
compact_storage& operator= (compact_storage const&) = default;
|
||||
|
||||
T& get() noexcept
|
||||
{
|
||||
return *static_cast< T* >(this);
|
||||
}
|
||||
|
||||
T const& get() const noexcept
|
||||
{
|
||||
return *static_cast< const T* >(this);
|
||||
}
|
||||
};
|
||||
|
||||
template< typename T, typename Tag >
|
||||
class compact_storage< T, Tag, false >
|
||||
{
|
||||
private:
|
||||
T m_data;
|
||||
|
||||
public:
|
||||
template< typename... Args >
|
||||
constexpr compact_storage(Args&&... args) noexcept(std::is_nothrow_constructible< T, Args... >::value) :
|
||||
m_data(static_cast< Args&& >(args)...)
|
||||
{
|
||||
}
|
||||
|
||||
compact_storage(compact_storage&&) = default;
|
||||
compact_storage& operator= (compact_storage&&) = default;
|
||||
|
||||
compact_storage(compact_storage const&) = default;
|
||||
compact_storage& operator= (compact_storage const&) = default;
|
||||
|
||||
T& get() noexcept
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
T const& get() const noexcept
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/scope/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_COMPACT_STORAGE_HPP_INCLUDED_
|
||||
50
include/boost/scope/detail/config.hpp
Normal file
50
include/boost/scope/detail/config.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/config.hpp
|
||||
*
|
||||
* This header contains Boost.Scope common configuration.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_CONFIG_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_CONFIG_HPP_INCLUDED_
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/scope/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if !(defined(__cpp_noexcept_function_type) && __cpp_noexcept_function_type >= 201510l) && !defined(_NOEXCEPT_TYPES_SUPPORTED)
|
||||
#define BOOST_SCOPE_NO_CXX17_NOEXCEPT_FUNCTION_TYPES
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_SCOPE_DETAIL_DOC_ALT)
|
||||
#if !defined(BOOST_SCOPE_DOXYGEN)
|
||||
#define BOOST_SCOPE_DETAIL_DOC_ALT(alt, ...) __VA_ARGS__
|
||||
#else
|
||||
#define BOOST_SCOPE_DETAIL_DOC_ALT(alt, ...) alt
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_SCOPE_DETAIL_DOC_HIDDEN)
|
||||
#define BOOST_SCOPE_DETAIL_DOC_HIDDEN(...) BOOST_SCOPE_DETAIL_DOC_ALT(..., __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_SCOPE_DETAIL_DOC)
|
||||
#if !defined(BOOST_SCOPE_DOXYGEN)
|
||||
#define BOOST_SCOPE_DETAIL_DOC(...)
|
||||
#else
|
||||
#define BOOST_SCOPE_DETAIL_DOC(...) __VA_ARGS__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/scope/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_CONFIG_HPP_INCLUDED_
|
||||
22
include/boost/scope/detail/footer.hpp
Normal file
22
include/boost/scope/detail/footer.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
|
||||
#if !defined(BOOST_SCOPE_ENABLE_WARNINGS)
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
#elif (defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) \
|
||||
&& (__GNUC__ * 100 + __GNUC_MINOR__) >= 406) || defined(__clang__)
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#endif
|
||||
|
||||
#endif // !defined(BOOST_SCOPE_ENABLE_WARNINGS)
|
||||
49
include/boost/scope/detail/header.hpp
Normal file
49
include/boost/scope/detail/header.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
|
||||
#if !defined(BOOST_SCOPE_ENABLE_WARNINGS)
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
|
||||
#pragma warning(push, 3)
|
||||
// unreferenced formal parameter
|
||||
#pragma warning(disable: 4100)
|
||||
// conditional expression is constant
|
||||
#pragma warning(disable: 4127)
|
||||
// function marked as __forceinline not inlined
|
||||
#pragma warning(disable: 4714)
|
||||
// decorated name length exceeded, name was truncated
|
||||
#pragma warning(disable: 4503)
|
||||
// qualifier applied to function type has no meaning; ignored
|
||||
#pragma warning(disable: 4180)
|
||||
// qualifier applied to reference type; ignored
|
||||
#pragma warning(disable: 4181)
|
||||
// unreachable code
|
||||
#pragma warning(disable: 4702)
|
||||
// destructor never returns, potential memory leak
|
||||
#pragma warning(disable: 4722)
|
||||
|
||||
#elif (defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) \
|
||||
&& (__GNUC__ * 100 + __GNUC_MINOR__) >= 406) || defined(__clang__)
|
||||
|
||||
// Note: clang-cl goes here as well, as it seems to support gcc-style warning control pragmas.
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
// unused parameter 'arg'
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
// unused function 'foo'
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
|
||||
#if defined(__clang__)
|
||||
// template argument uses unnamed type
|
||||
#pragma clang diagnostic ignored "-Wunnamed-type-template-args"
|
||||
#endif // defined(__clang__)
|
||||
|
||||
#endif
|
||||
|
||||
#endif // !defined(BOOST_SCOPE_ENABLE_WARNINGS)
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/is_nonnull_default_constructible.hpp
|
||||
*
|
||||
* This header contains definition of \c is_nonnull_default_constructible
|
||||
* and \c is_nothrow_nonnull_default_constructible type traits. The type
|
||||
* traits are useful for preventing default-construction of pointers to
|
||||
* functions where a default-constructed function object is expected.
|
||||
* Without it, default- or value-constructing a pointer to function would
|
||||
* produce a function object that is not callable.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_IS_NONNULL_DEFAULT_CONSTRUCTIBLE_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_IS_NONNULL_DEFAULT_CONSTRUCTIBLE_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
#include <boost/scope/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
//! The type trait checks if \c T is not a pointer and is default-constructible
|
||||
template< typename T >
|
||||
struct is_nonnull_default_constructible :
|
||||
public std::is_default_constructible< T >
|
||||
{
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
struct is_nonnull_default_constructible< T* > :
|
||||
public std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
//! The type trait checks if \c T is not a pointer and is nothrow-default-constructible
|
||||
template< typename T >
|
||||
struct is_nothrow_nonnull_default_constructible :
|
||||
public std::is_nothrow_default_constructible< T >
|
||||
{
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
struct is_nothrow_nonnull_default_constructible< T* > :
|
||||
public std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/scope/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_IS_NONNULL_DEFAULT_CONSTRUCTIBLE_HPP_INCLUDED_
|
||||
49
include/boost/scope/detail/is_not_like.hpp
Normal file
49
include/boost/scope/detail/is_not_like.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/is_not_like.hpp
|
||||
*
|
||||
* This header contains definition of \c is_not_like type trait.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_IS_NOT_LIKE_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_IS_NOT_LIKE_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
#include <boost/scope/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
//! The type trait checks if \c T is not a possibly cv-reference-qualified specialization of \c Template
|
||||
template< typename T, template< typename... > class Template >
|
||||
struct is_not_like : public std::true_type { };
|
||||
template< typename T, template< typename... > class Template >
|
||||
struct is_not_like< T&, Template > : public is_not_like< T, Template > { };
|
||||
template< template< typename... > class Template, typename... Ts >
|
||||
struct is_not_like< Template< Ts... >, Template > : public std::false_type { };
|
||||
template< template< typename... > class Template, typename... Ts >
|
||||
struct is_not_like< const Template< Ts... >, Template > : public std::false_type { };
|
||||
template< template< typename... > class Template, typename... Ts >
|
||||
struct is_not_like< volatile Template< Ts... >, Template > : public std::false_type { };
|
||||
template< template< typename... > class Template, typename... Ts >
|
||||
struct is_not_like< const volatile Template< Ts... >, Template > : public std::false_type { };
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/scope/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_IS_NOT_LIKE_HPP_INCLUDED_
|
||||
52
include/boost/scope/detail/move_or_copy_assign_ref.hpp
Normal file
52
include/boost/scope/detail/move_or_copy_assign_ref.hpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2022 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/move_or_copy_assign_ref.hpp
|
||||
*
|
||||
* This header contains definition of \c move_or_copy_assign_ref type trait.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_MOVE_OR_COPY_ASSIGN_REF_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_MOVE_OR_COPY_ASSIGN_REF_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
#include <boost/scope/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
//! The type trait produces an rvalue reference to \a From if \a To has a non-throwing assignment from a \a From rvalue and an lvalue reference otherwise.
|
||||
template< typename From, typename To = From >
|
||||
struct move_or_copy_assign_ref
|
||||
{
|
||||
using type = typename std::conditional<
|
||||
std::is_nothrow_assignable< To, From >::value,
|
||||
From&&,
|
||||
From const&
|
||||
>::type;
|
||||
};
|
||||
|
||||
template< typename From, typename To >
|
||||
struct move_or_copy_assign_ref< From&, To >
|
||||
{
|
||||
using type = From&;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/scope/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_MOVE_OR_COPY_ASSIGN_REF_HPP_INCLUDED_
|
||||
52
include/boost/scope/detail/move_or_copy_construct_ref.hpp
Normal file
52
include/boost/scope/detail/move_or_copy_construct_ref.hpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2022 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/move_or_copy_construct_ref.hpp
|
||||
*
|
||||
* This header contains definition of \c move_or_copy_construct_ref type trait.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_MOVE_OR_COPY_CONSTRUCT_REF_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_MOVE_OR_COPY_CONSTRUCT_REF_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
#include <boost/scope/detail/header.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
//! The type trait produces an rvalue reference to \a From if \a To has a non-throwing constructor from a \a From rvalue and an lvalue reference otherwise.
|
||||
template< typename From, typename To = From >
|
||||
struct move_or_copy_construct_ref
|
||||
{
|
||||
using type = typename std::conditional<
|
||||
std::is_nothrow_constructible< To, From >::value,
|
||||
From&&,
|
||||
From const&
|
||||
>::type;
|
||||
};
|
||||
|
||||
template< typename From, typename To >
|
||||
struct move_or_copy_construct_ref< From&, To >
|
||||
{
|
||||
using type = From&;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/scope/detail/footer.hpp>
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_MOVE_OR_COPY_CONSTRUCT_REF_HPP_INCLUDED_
|
||||
53
include/boost/scope/detail/type_traits/conjunction.hpp
Normal file
53
include/boost/scope/detail/type_traits/conjunction.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/type_traits/conjunction.hpp
|
||||
*
|
||||
* This header contains definition of \c conjunction type trait.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \
|
||||
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l))
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using std::conjunction;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/type_traits/conjunction.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using boost::conjunction;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_TYPE_TRAITS_CONJUNCTION_HPP_INCLUDED_
|
||||
53
include/boost/scope/detail/type_traits/disjunction.hpp
Normal file
53
include/boost/scope/detail/type_traits/disjunction.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/type_traits/disjunction.hpp
|
||||
*
|
||||
* This header contains definition of \c disjunction type trait.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \
|
||||
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l))
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using std::disjunction;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/type_traits/disjunction.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using boost::disjunction;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_TYPE_TRAITS_DISJUNCTION_HPP_INCLUDED_
|
||||
53
include/boost/scope/detail/type_traits/is_final.hpp
Normal file
53
include/boost/scope/detail/type_traits/is_final.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/type_traits/is_final.hpp
|
||||
*
|
||||
* This header contains definition of \c is_final type trait.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_FINAL_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_FINAL_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if (defined(__cpp_lib_is_final) && (__cpp_lib_is_final >= 201402l)) || \
|
||||
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (BOOST_CXX_VERSION >= 201402l))
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using std::is_final;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/type_traits/is_final.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using boost::is_final;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_FINAL_HPP_INCLUDED_
|
||||
65
include/boost/scope/detail/type_traits/is_invocable.hpp
Normal file
65
include/boost/scope/detail/type_traits/is_invocable.hpp
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/type_traits/is_invocable.hpp
|
||||
*
|
||||
* This header contains definition of \c is_invocable type trait.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_INVOCABLE_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_INVOCABLE_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if (defined(__cpp_lib_is_invocable) && (__cpp_lib_is_invocable >= 201703l)) || \
|
||||
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (BOOST_CXX_VERSION >= 201703l))
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using std::is_invocable;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#else
|
||||
|
||||
#include <utility> // std::declval
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
// A simplified implementation that does not support member function pointers
|
||||
template< typename Func, typename... Args >
|
||||
struct is_invocable_impl
|
||||
{
|
||||
template< typename F = Func, typename = decltype(std::declval< F >()(std::declval< Args >()...)) >
|
||||
static std::true_type _check_invocable(int);
|
||||
static std::false_type _check_invocable(...);
|
||||
|
||||
using type = decltype(is_invocable_impl::_check_invocable(0));
|
||||
};
|
||||
|
||||
template< typename Func, typename... Args >
|
||||
struct is_invocable : public is_invocable_impl< Func, Args... >::type { };
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_INVOCABLE_HPP_INCLUDED_
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/type_traits/is_nothrow_invocable.hpp
|
||||
*
|
||||
* This header contains definition of \c is_nothrow_invocable type trait.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_NOTHROW_INVOCABLE_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_NOTHROW_INVOCABLE_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if (defined(__cpp_lib_is_invocable) && (__cpp_lib_is_invocable >= 201703l)) || \
|
||||
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (BOOST_CXX_VERSION >= 201703l))
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using std::is_nothrow_invocable;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#else
|
||||
|
||||
#include <utility> // std::declval
|
||||
#include <boost/scope/detail/type_traits/is_invocable.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
template< bool, typename Func, typename... Args >
|
||||
struct is_nothrow_invocable_impl
|
||||
{
|
||||
using type = std::false_type;
|
||||
};
|
||||
|
||||
template< typename Func, typename... Args >
|
||||
struct is_nothrow_invocable_impl< true, Func, Args... >
|
||||
{
|
||||
using type = std::integral_constant< bool, noexcept(std::declval< Func >()(std::declval< Args >()...)) >;
|
||||
};
|
||||
|
||||
template< typename Func, typename... Args >
|
||||
struct is_nothrow_invocable :
|
||||
public is_nothrow_invocable_impl< detail::is_invocable< Func, Args... >::value, Func, Args... >::type
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_NOTHROW_INVOCABLE_HPP_INCLUDED_
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/type_traits/is_nothrow_swappable.hpp
|
||||
*
|
||||
* This header contains definition of \c is_nothrow_swappable type trait.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_NOTHROW_SWAPPABLE_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_NOTHROW_SWAPPABLE_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if (defined(__cpp_lib_is_swappable) && (__cpp_lib_is_swappable >= 201603l)) || \
|
||||
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190024210) && (BOOST_CXX_VERSION >= 201703l))
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using std::is_nothrow_swappable;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/type_traits/is_nothrow_swappable.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using boost::is_nothrow_swappable;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_NOTHROW_SWAPPABLE_HPP_INCLUDED_
|
||||
53
include/boost/scope/detail/type_traits/is_swappable.hpp
Normal file
53
include/boost/scope/detail/type_traits/is_swappable.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/type_traits/is_swappable.hpp
|
||||
*
|
||||
* This header contains definition of \c is_swappable type trait.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_SWAPPABLE_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_SWAPPABLE_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if (defined(__cpp_lib_is_swappable) && (__cpp_lib_is_swappable >= 201603l)) || \
|
||||
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190024210) && (BOOST_CXX_VERSION >= 201703l))
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using std::is_swappable;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/type_traits/is_swappable.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using boost::is_swappable;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_TYPE_TRAITS_IS_SWAPPABLE_HPP_INCLUDED_
|
||||
53
include/boost/scope/detail/type_traits/negation.hpp
Normal file
53
include/boost/scope/detail/type_traits/negation.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* Copyright (c) 2023 Andrey Semashev
|
||||
*/
|
||||
/*!
|
||||
* \file scope/detail/type_traits/negation.hpp
|
||||
*
|
||||
* This header contains definition of \c negation type trait.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SCOPE_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_
|
||||
#define BOOST_SCOPE_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/scope/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if (defined(__cpp_lib_logical_traits) && (__cpp_lib_logical_traits >= 201510l)) || \
|
||||
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (_MSC_FULL_VER >= 190023918) && (BOOST_CXX_VERSION >= 201703l))
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using std::negation;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/type_traits/negation.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace scope {
|
||||
namespace detail {
|
||||
|
||||
using boost::negation;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace scope
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SCOPE_DETAIL_TYPE_TRAITS_NEGATION_HPP_INCLUDED_
|
||||
Reference in New Issue
Block a user