mirror of
https://github.com/boostorg/move.git
synced 2025-08-03 06:04:26 +02:00
Divide meta_utils in two headers, core (with [dis|en]able_if[_c], is_same, integral_constant, identity) and the rest.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2012-2012.
|
||||
// (C) Copyright Ion Gaztanaga 2012-2015.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -18,7 +18,7 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/move/detail/config_begin.hpp>
|
||||
#include <boost/move/detail/meta_utils_core.hpp>
|
||||
#include <cstddef> //for std::size_t
|
||||
|
||||
//Small meta-typetraits to support move
|
||||
@@ -40,78 +40,6 @@ struct nat{};
|
||||
//////////////////////////////////////
|
||||
template <class T> struct natify{};
|
||||
|
||||
//////////////////////////////////////
|
||||
// if_c
|
||||
//////////////////////////////////////
|
||||
template<bool C, typename T1, typename T2>
|
||||
struct if_c
|
||||
{
|
||||
typedef T1 type;
|
||||
};
|
||||
|
||||
template<typename T1, typename T2>
|
||||
struct if_c<false,T1,T2>
|
||||
{
|
||||
typedef T2 type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// if_
|
||||
//////////////////////////////////////
|
||||
template<typename T1, typename T2, typename T3>
|
||||
struct if_
|
||||
{
|
||||
typedef typename if_c<0 != T1::value, T2, T3>::type type;
|
||||
};
|
||||
|
||||
//enable_if_
|
||||
template <bool B, class T = nat>
|
||||
struct enable_if_c
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// enable_if_c
|
||||
//////////////////////////////////////
|
||||
template <class T>
|
||||
struct enable_if_c<false, T> {};
|
||||
|
||||
//////////////////////////////////////
|
||||
// enable_if
|
||||
//////////////////////////////////////
|
||||
template <class Cond, class T = nat>
|
||||
struct enable_if : public enable_if_c<Cond::value, T> {};
|
||||
|
||||
//////////////////////////////////////
|
||||
// disable_if
|
||||
//////////////////////////////////////
|
||||
template <class Cond, class T = nat>
|
||||
struct disable_if : public enable_if_c<!Cond::value, T> {};
|
||||
|
||||
//////////////////////////////////////
|
||||
// integral_constant
|
||||
//////////////////////////////////////
|
||||
template<class T, T v>
|
||||
struct integral_constant
|
||||
{
|
||||
static const T value = v;
|
||||
typedef T value_type;
|
||||
typedef integral_constant<T, v> type;
|
||||
};
|
||||
|
||||
typedef integral_constant<bool, true > true_type;
|
||||
typedef integral_constant<bool, false > false_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// identity
|
||||
//////////////////////////////////////
|
||||
template <class T>
|
||||
struct identity
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// remove_reference
|
||||
//////////////////////////////////////
|
||||
@@ -231,22 +159,6 @@ struct add_const_lvalue_reference
|
||||
<t_unreferenced_const>::type type;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_same
|
||||
//////////////////////////////////////
|
||||
template<class T, class U>
|
||||
struct is_same
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_same<T, T>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_lvalue_reference
|
||||
//////////////////////////////////////
|
||||
@@ -475,6 +387,4 @@ template< class T > struct remove_rvalue_reference { typedef T type; };
|
||||
} //namespace move_detail {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/move/detail/config_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP
|
||||
|
116
include/boost/move/detail/meta_utils_core.hpp
Normal file
116
include/boost/move/detail/meta_utils_core.hpp
Normal file
@@ -0,0 +1,116 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2015-2015.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/move for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP
|
||||
#define BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//Small meta-typetraits to support move
|
||||
|
||||
namespace boost {
|
||||
namespace move_detail {
|
||||
|
||||
//////////////////////////////////////
|
||||
// if_c
|
||||
//////////////////////////////////////
|
||||
template<bool C, typename T1, typename T2>
|
||||
struct if_c
|
||||
{
|
||||
typedef T1 type;
|
||||
};
|
||||
|
||||
template<typename T1, typename T2>
|
||||
struct if_c<false,T1,T2>
|
||||
{
|
||||
typedef T2 type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// if_
|
||||
//////////////////////////////////////
|
||||
template<typename T1, typename T2, typename T3>
|
||||
struct if_
|
||||
{
|
||||
typedef typename if_c<0 != T1::value, T2, T3>::type type;
|
||||
};
|
||||
|
||||
//enable_if_
|
||||
template <bool B, class T = void>
|
||||
struct enable_if_c
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// enable_if_c
|
||||
//////////////////////////////////////
|
||||
template <class T>
|
||||
struct enable_if_c<false, T> {};
|
||||
|
||||
//////////////////////////////////////
|
||||
// enable_if
|
||||
//////////////////////////////////////
|
||||
template <class Cond, class T = void>
|
||||
struct enable_if : public enable_if_c<Cond::value, T> {};
|
||||
|
||||
//////////////////////////////////////
|
||||
// disable_if
|
||||
//////////////////////////////////////
|
||||
template <class Cond, class T = void>
|
||||
struct disable_if : public enable_if_c<!Cond::value, T> {};
|
||||
|
||||
//////////////////////////////////////
|
||||
// integral_constant
|
||||
//////////////////////////////////////
|
||||
template<class T, T v>
|
||||
struct integral_constant
|
||||
{
|
||||
static const T value = v;
|
||||
typedef T value_type;
|
||||
typedef integral_constant<T, v> type;
|
||||
};
|
||||
|
||||
typedef integral_constant<bool, true > true_type;
|
||||
typedef integral_constant<bool, false > false_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// identity
|
||||
//////////////////////////////////////
|
||||
template <class T>
|
||||
struct identity
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////
|
||||
// is_same
|
||||
//////////////////////////////////////
|
||||
template<class T, class U>
|
||||
struct is_same
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_same<T, T>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
} //namespace move_detail {
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_CORE_HPP
|
@@ -237,6 +237,7 @@ Global
|
||||
..\..\doc\Jamfile.v2 = ..\..\doc\Jamfile.v2
|
||||
..\..\..\..\boost\move\make_unique.hpp = ..\..\..\..\boost\move\make_unique.hpp
|
||||
..\..\..\..\boost\move\detail\meta_utils.hpp = ..\..\..\..\boost\move\detail\meta_utils.hpp
|
||||
..\..\..\..\boost\move\detail\meta_utils_core.hpp = ..\..\..\..\boost\move\detail\meta_utils_core.hpp
|
||||
..\..\..\..\boost\move\move.hpp = ..\..\..\..\boost\move\move.hpp
|
||||
..\..\doc\move.qbk = ..\..\doc\move.qbk
|
||||
..\..\..\..\boost\move\detail\move_helpers.hpp = ..\..\..\..\boost\move\detail\move_helpers.hpp
|
||||
|
Reference in New Issue
Block a user