1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

fix type_traits implementations

This commit is contained in:
bolero-MURAKAMI 2015-04-13 11:26:17 +09:00
parent 78e954aa58
commit f78e5d49a0
12 changed files with 148 additions and 58 deletions

View file

@ -10,15 +10,25 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
#include <sprout/type_traits/integral_constant.hpp>
namespace sprout {
//
// is_copy_assignable
//
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_copy_assignable_impl
: public sprout::false_type
{};
template<typename T>
struct is_copy_assignable_impl<T, false>
: public std::is_assignable<T, T const&>
{};
} // namespace detail
template<typename T>
struct is_copy_assignable
: public sprout::detail::type_traits_wrapper<std::is_copy_assignable<T> >
: public sprout::detail::is_copy_assignable_impl<T>
{};
#if SPROUT_USE_VARIABLE_TEMPLATES

View file

@ -10,15 +10,25 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
#include <sprout/type_traits/integral_constant.hpp>
namespace sprout {
//
// is_copy_constructible
//
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_copy_constructible_impl
: public sprout::false_type
{};
template<typename T>
struct is_copy_constructible_impl<T, false>
: public std::is_constructible<T, T const&>
{};
} // namespace detail
template<typename T>
struct is_copy_constructible
: public sprout::detail::type_traits_wrapper<std::is_copy_constructible<T> >
: public sprout::detail::is_copy_constructible_impl<T>
{};
#if SPROUT_USE_VARIABLE_TEMPLATES

View file

@ -10,15 +10,25 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
#include <sprout/type_traits/integral_constant.hpp>
namespace sprout {
//
// is_move_assignable
//
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_move_assignable_impl
: public sprout::false_type
{};
template<typename T>
struct is_move_assignable_impl<T, false>
: public std::is_assignable<T, T&&>
{};
} // namespace detail
template<typename T>
struct is_move_assignable
: public sprout::detail::type_traits_wrapper<std::is_move_assignable<T> >
: public sprout::detail::is_move_assignable_impl<T>
{};
#if SPROUT_USE_VARIABLE_TEMPLATES

View file

@ -10,15 +10,25 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
#include <sprout/type_traits/integral_constant.hpp>
namespace sprout {
//
// is_move_constructible
//
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_move_constructible_impl
: public sprout::false_type
{};
template<typename T>
struct is_move_constructible_impl<T, false>
: public std::is_constructible<T, T&&>
{};
} // namespace detail
template<typename T>
struct is_move_constructible
: public sprout::detail::type_traits_wrapper<std::is_move_constructible<T> >
: public sprout::detail::is_move_constructible_impl<T>
{};
#if SPROUT_USE_VARIABLE_TEMPLATES

View file

@ -10,15 +10,26 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type_traits/is_nothrow_assignable.hpp>
namespace sprout {
//
// is_nothrow_copy_assignable
//
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_nothrow_copy_assignable_impl
: public sprout::false_type
{};
template<typename T>
struct is_nothrow_copy_assignable_impl<T, false>
: public sprout::is_nothrow_assignable<T, T const&>
{};
} // namespace detail
template<typename T>
struct is_nothrow_copy_assignable
: public sprout::detail::type_traits_wrapper<std::is_nothrow_copy_assignable<T> >
: public sprout::detail::is_nothrow_copy_assignable_impl<T>
{};
#if SPROUT_USE_VARIABLE_TEMPLATES

View file

@ -10,15 +10,26 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type_traits/is_nothrow_constructible.hpp>
namespace sprout {
//
// is_nothrow_copy_constructible
//
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_nothrow_copy_constructible_impl
: public sprout::false_type
{};
template<typename T>
struct is_nothrow_copy_constructible_impl<T, false>
: public sprout::is_nothrow_constructible<T, T const&>
{};
} // namespace detail
template<typename T>
struct is_nothrow_copy_constructible
: public sprout::detail::type_traits_wrapper<std::is_nothrow_copy_constructible<T> >
: public sprout::detail::is_nothrow_copy_constructible_impl<T>
{};
#if SPROUT_USE_VARIABLE_TEMPLATES

View file

@ -10,15 +10,26 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type_traits/is_nothrow_assignable.hpp>
namespace sprout {
//
// is_nothrow_move_assignable
//
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_nothrow_move_assignable_impl
: public sprout::false_type
{};
template<typename T>
struct is_nothrow_move_assignable_impl<T, false>
: public sprout::is_nothrow_assignable<T, T&&>
{};
} // namespace detail
template<typename T>
struct is_nothrow_move_assignable
: public sprout::detail::type_traits_wrapper<std::is_nothrow_move_assignable<T> >
: public sprout::detail::is_nothrow_move_assignable_impl<T>
{};
#if SPROUT_USE_VARIABLE_TEMPLATES

View file

@ -10,15 +10,26 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type_traits/is_nothrow_constructible.hpp>
namespace sprout {
//
// is_nothrow_move_constructible
//
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_nothrow_move_constructible_impl
: public sprout::false_type
{};
template<typename T>
struct is_nothrow_move_constructible_impl<T, false>
: public sprout::is_nothrow_constructible<T, T&&>
{};
} // namespace detail
template<typename T>
struct is_nothrow_move_constructible
: public sprout::detail::type_traits_wrapper<std::is_nothrow_move_constructible<T> >
: public sprout::detail::is_nothrow_move_constructible_impl<T>
{};
#if SPROUT_USE_VARIABLE_TEMPLATES

View file

@ -10,27 +10,27 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type_traits/is_trivially_assignable.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
namespace sprout {
//
// is_trivially_copy_assignable
//
#if !defined(_LIBCPP_VERSION)
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_trivially_copy_assignable_impl
: public sprout::false_type
{};
template<typename T>
struct is_trivially_copy_assignable_impl<T, false>
: public sprout::is_trivially_assignable<T, T const&>
{};
} // namespace detail
template<typename T>
struct is_trivially_copy_assignable
: public sprout::is_trivially_assignable<
typename std::add_lvalue_reference<T>::type,
typename std::add_lvalue_reference<T>::type const
>
: public sprout::detail::is_trivially_copy_assignable_impl<T>
{};
#else // #if !defined(_LIBCPP_VERSION)
template<typename T>
struct is_trivially_copy_assignable
: public sprout::detail::type_traits_wrapper<std::is_trivially_copy_assignable<T> >
{};
#endif // #if !defined(_LIBCPP_VERSION)
#if SPROUT_USE_VARIABLE_TEMPLATES
template<typename T>

View file

@ -10,24 +10,27 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type_traits/is_trivially_constructible.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
namespace sprout {
//
// is_trivially_copy_constructible
//
#if !defined(_LIBCPP_VERSION)
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_trivially_copy_constructible_impl
: public sprout::false_type
{};
template<typename T>
struct is_trivially_copy_constructible_impl<T, false>
: public sprout::is_trivially_constructible<T, T const&>
{};
} // namespace detail
template<typename T>
struct is_trivially_copy_constructible
: public sprout::is_trivially_constructible<T, typename std::add_lvalue_reference<T>::type const>
: public sprout::detail::is_trivially_copy_constructible_impl<T>
{};
#else // #if !defined(_LIBCPP_VERSION)
template<typename T>
struct is_trivially_copy_constructible
: public sprout::detail::type_traits_wrapper<std::is_trivially_copy_constructible<T> >
{};
#endif // #if !defined(_LIBCPP_VERSION)
#if SPROUT_USE_VARIABLE_TEMPLATES
template<typename T>

View file

@ -10,27 +10,27 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type_traits/is_trivially_assignable.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
namespace sprout {
//
// is_trivially_move_assignable
//
#if !defined(_LIBCPP_VERSION)
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_trivially_move_assignable_impl
: public sprout::false_type
{};
template<typename T>
struct is_trivially_move_assignable_impl<T, false>
: public sprout::is_trivially_assignable<T, T&&>
{};
} // namespace detail
template<typename T>
struct is_trivially_move_assignable
: public sprout::is_trivially_assignable<
typename std::add_lvalue_reference<T>::type,
typename std::add_rvalue_reference<T>::type
>
: public sprout::detail::is_trivially_move_assignable_impl<T>
{};
#else // #if !defined(_LIBCPP_VERSION)
template<typename T>
struct is_trivially_move_assignable
: public sprout::detail::type_traits_wrapper<std::is_trivially_move_assignable<T> >
{};
#endif // #if !defined(_LIBCPP_VERSION)
#if SPROUT_USE_VARIABLE_TEMPLATES
template<typename T>

View file

@ -10,24 +10,27 @@
#include <type_traits>
#include <sprout/config.hpp>
#include <sprout/type_traits/integral_constant.hpp>
#include <sprout/type_traits/is_trivially_constructible.hpp>
#include <sprout/type_traits/detail/type_traits_wrapper.hpp>
namespace sprout {
//
// is_trivially_move_constructible
//
#if !defined(_LIBCPP_VERSION)
namespace detail {
template<typename T, bool = std::is_void<T>::value>
struct is_trivially_move_constructible_impl
: public sprout::false_type
{};
template<typename T>
struct is_trivially_move_constructible_impl<T, false>
: public sprout::is_trivially_constructible<T, T&&>
{};
} // namespace detail
template<typename T>
struct is_trivially_move_constructible
: public sprout::is_trivially_constructible<T, typename std::add_rvalue_reference<T>::type>
: public sprout::detail::is_trivially_move_constructible_impl<T>
{};
#else // #if !defined(_LIBCPP_VERSION)
template<typename T>
struct is_trivially_move_constructible
: public sprout::detail::type_traits_wrapper<std::is_trivially_move_constructible<T> >
{};
#endif // #if !defined(_LIBCPP_VERSION)
#if SPROUT_USE_VARIABLE_TEMPLATES
template<typename T>