Replace boost::enable_if/disable_if/enable_if_c/disable_if_c by std::enable_if
This commit is contained in:
parent
1e13cf6fec
commit
d21137739d
@ -1230,7 +1230,7 @@ namespace nasal
|
|||||||
// Either const CallContext& or CallContext, non-const reference
|
// Either const CallContext& or CallContext, non-const reference
|
||||||
// does not make sense.
|
// does not make sense.
|
||||||
static_assert(
|
static_assert(
|
||||||
!boost::is_same<Arg, CallContext&>::value,
|
!std::is_same<Arg, CallContext&>::value,
|
||||||
"Only const reference and value make sense!");
|
"Only const reference and value make sense!");
|
||||||
return ctx;
|
return ctx;
|
||||||
};
|
};
|
||||||
|
@ -24,11 +24,6 @@
|
|||||||
|
|
||||||
#include <simgear/structure/map.hxx>
|
#include <simgear/structure/map.hxx>
|
||||||
#include <boost/iterator/iterator_facade.hpp>
|
#include <boost/iterator/iterator_facade.hpp>
|
||||||
#if BOOST_VERSION >= 105600
|
|
||||||
#include <boost/core/enable_if.hpp>
|
|
||||||
#else
|
|
||||||
#include <boost/utility/enable_if.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace nasal
|
namespace nasal
|
||||||
{
|
{
|
||||||
@ -125,9 +120,9 @@ namespace nasal
|
|||||||
* @param name Member name
|
* @param name Member name
|
||||||
*/
|
*/
|
||||||
template<class Sig, class Key>
|
template<class Sig, class Key>
|
||||||
typename boost::enable_if< boost::is_function<Sig>,
|
typename std::enable_if< std::is_function<Sig>::value,
|
||||||
boost::function<Sig>
|
std::function<Sig>
|
||||||
>::type
|
>::type
|
||||||
get(const Key& name) const
|
get(const Key& name) const
|
||||||
{
|
{
|
||||||
BOOST_STATIC_ASSERT(( boost::is_convertible<Key, naRef>::value
|
BOOST_STATIC_ASSERT(( boost::is_convertible<Key, naRef>::value
|
||||||
@ -242,9 +237,9 @@ namespace nasal
|
|||||||
*/
|
*/
|
||||||
template<bool is_other_const>
|
template<bool is_other_const>
|
||||||
Iterator( Iterator<is_other_const> const& other,
|
Iterator( Iterator<is_other_const> const& other,
|
||||||
typename boost::enable_if_c< is_const || !is_other_const,
|
typename std::enable_if< is_const || !is_other_const,
|
||||||
void*
|
void*
|
||||||
>::type = NULL ):
|
>::type = NULL ):
|
||||||
_hash(other._hash),
|
_hash(other._hash),
|
||||||
_index(other._index)
|
_index(other._index)
|
||||||
{}
|
{}
|
||||||
|
@ -24,44 +24,13 @@
|
|||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
#if PROPS_STANDALONE
|
#if PROPS_STANDALONE
|
||||||
// taken from: boost/utility/enable_if.hpp
|
# ifndef SG_LOG
|
||||||
#ifndef SG_LOG
|
# define SG_GENERAL 0
|
||||||
# define SG_GENERAL 0
|
# define SG_ALERT 0
|
||||||
# define SG_ALERT 0
|
# define SG_WARN 1
|
||||||
# define SG_WARN 1
|
# define SG_LOG(type, level, message) (type) ? (std::cerr <<message << endl) : (std::cout <<message << endl)
|
||||||
# define SG_LOG(type, level, message) (type) ? (std::cerr <<message << endl) : (std::cout <<message << endl)
|
# endif
|
||||||
#endif
|
|
||||||
namespace boost {
|
|
||||||
template <bool B, class T = void>
|
|
||||||
struct enable_if_c {
|
|
||||||
typedef T type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
struct enable_if_c<false, T> {};
|
|
||||||
|
|
||||||
template <class Cond, class T = void>
|
|
||||||
struct enable_if : public enable_if_c<Cond::value, T> {};
|
|
||||||
|
|
||||||
template <bool B, class T = void>
|
|
||||||
struct disable_if_c {
|
|
||||||
typedef T type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
struct disable_if_c<true, T> {};
|
|
||||||
|
|
||||||
template <class Cond, class T = void>
|
|
||||||
struct disable_if : public disable_if_c<Cond::value, T> {};
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
# include <boost/type_traits/is_enum.hpp>
|
|
||||||
#if BOOST_VERSION >= 105600
|
|
||||||
#include <boost/core/enable_if.hpp>
|
|
||||||
#else
|
|
||||||
#include <boost/utility/enable_if.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# include <simgear/debug/logstream.hxx>
|
# include <simgear/debug/logstream.hxx>
|
||||||
# include <simgear/math/SGMathFwd.hxx>
|
# include <simgear/math/SGMathFwd.hxx>
|
||||||
# include <simgear/math/sg_types.hxx>
|
# include <simgear/math/sg_types.hxx>
|
||||||
@ -1263,11 +1232,11 @@ public:
|
|||||||
* match the desired type, a conversion isn't guaranteed.
|
* match the desired type, a conversion isn't guaranteed.
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T getValue(typename boost::enable_if_c<simgear::props::PropertyTraits<T>::Internal>
|
T getValue(typename std::enable_if<simgear::props::PropertyTraits<T>::Internal>
|
||||||
::type* dummy = 0) const;
|
::type* dummy = 0) const;
|
||||||
// Getter for extended property
|
// Getter for extended property
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T getValue(typename boost::disable_if_c<simgear::props::PropertyTraits<T>::Internal>
|
T getValue(typename std::enable_if<!simgear::props::PropertyTraits<T>::Internal>
|
||||||
::type* dummy = 0) const;
|
::type* dummy = 0) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1331,12 +1300,12 @@ public:
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool setValue(const T& val,
|
bool setValue(const T& val,
|
||||||
typename boost::enable_if_c<simgear::props::PropertyTraits<T>::Internal>
|
typename std::enable_if<simgear::props::PropertyTraits<T>::Internal>
|
||||||
::type* dummy = 0);
|
::type* dummy = 0);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool setValue(const T& val,
|
bool setValue(const T& val,
|
||||||
typename boost::disable_if_c<simgear::props::PropertyTraits<T>::Internal>
|
typename std::enable_if<!simgear::props::PropertyTraits<T>::Internal>
|
||||||
::type* dummy = 0);
|
::type* dummy = 0);
|
||||||
|
|
||||||
template<int N>
|
template<int N>
|
||||||
@ -1899,7 +1868,7 @@ template<typename T>
|
|||||||
#if PROPS_STANDALONE
|
#if PROPS_STANDALONE
|
||||||
T
|
T
|
||||||
#else
|
#else
|
||||||
typename boost::disable_if<boost::is_enum<T>, T>::type
|
typename std::enable_if<!std::is_enum<T>::value, T>::type
|
||||||
#endif
|
#endif
|
||||||
getValue(const SGPropertyNode*);
|
getValue(const SGPropertyNode*);
|
||||||
|
|
||||||
@ -1967,7 +1936,7 @@ template<typename T>
|
|||||||
#if PROPS_STANDALONE
|
#if PROPS_STANDALONE
|
||||||
inline T
|
inline T
|
||||||
#else
|
#else
|
||||||
inline typename boost::enable_if<boost::is_enum<T>, T>::type
|
inline typename std::enable_if<std::is_enum<T>::value, T>::type
|
||||||
#endif
|
#endif
|
||||||
getValue(const SGPropertyNode* node)
|
getValue(const SGPropertyNode* node)
|
||||||
{
|
{
|
||||||
@ -2053,7 +2022,7 @@ bool SGPropertyNode::tie (const SGRawValue<const char *> &rawValue,
|
|||||||
bool useDefault);
|
bool useDefault);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T SGPropertyNode::getValue(typename boost::disable_if_c<simgear::props
|
T SGPropertyNode::getValue(typename std::enable_if<!simgear::props
|
||||||
::PropertyTraits<T>::Internal>::type* dummy) const
|
::PropertyTraits<T>::Internal>::type* dummy) const
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear::props;
|
||||||
@ -2081,7 +2050,7 @@ T SGPropertyNode::getValue(typename boost::disable_if_c<simgear::props
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T SGPropertyNode::getValue(typename boost::enable_if_c<simgear::props
|
inline T SGPropertyNode::getValue(typename std::enable_if<simgear::props
|
||||||
::PropertyTraits<T>::Internal>::type* dummy) const
|
::PropertyTraits<T>::Internal>::type* dummy) const
|
||||||
{
|
{
|
||||||
return ::getValue<T>(this);
|
return ::getValue<T>(this);
|
||||||
@ -2108,7 +2077,7 @@ std::vector<T> SGPropertyNode::getChildValues(const std::string& name) const
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool SGPropertyNode::setValue(const T& val,
|
bool SGPropertyNode::setValue(const T& val,
|
||||||
typename boost::disable_if_c<simgear::props
|
typename std::enable_if<!simgear::props
|
||||||
::PropertyTraits<T>::Internal>::type* dummy)
|
::PropertyTraits<T>::Internal>::type* dummy)
|
||||||
{
|
{
|
||||||
using namespace simgear::props;
|
using namespace simgear::props;
|
||||||
@ -2137,7 +2106,7 @@ bool SGPropertyNode::setValue(const T& val,
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline bool SGPropertyNode::setValue(const T& val,
|
inline bool SGPropertyNode::setValue(const T& val,
|
||||||
typename boost::enable_if_c<simgear::props
|
typename std::enable_if<simgear::props
|
||||||
::PropertyTraits<T>::Internal>::type* dummy)
|
::PropertyTraits<T>::Internal>::type* dummy)
|
||||||
{
|
{
|
||||||
return ::setValue(this, val);
|
return ::setValue(this, val);
|
||||||
|
@ -21,13 +21,6 @@
|
|||||||
#include "SGReferenced.hxx"
|
#include "SGReferenced.hxx"
|
||||||
#include "SGSharedPtr.hxx"
|
#include "SGSharedPtr.hxx"
|
||||||
|
|
||||||
#include <boost/type_traits/is_base_of.hpp>
|
|
||||||
#if BOOST_VERSION >= 105600
|
|
||||||
#include <boost/core/enable_if.hpp>
|
|
||||||
#else
|
|
||||||
#include <boost/utility/enable_if.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
// C4355: 'this' : used in base member initializer list
|
// C4355: 'this' : used in base member initializer list
|
||||||
@ -121,8 +114,8 @@ private:
|
|||||||
/// Upcast in a class hierarchy with a virtual base class
|
/// Upcast in a class hierarchy with a virtual base class
|
||||||
template<class T>
|
template<class T>
|
||||||
static
|
static
|
||||||
typename boost::enable_if<
|
typename std::enable_if<
|
||||||
boost::is_base_of<SGVirtualWeakReferenced, T>,
|
std::is_base_of<SGVirtualWeakReferenced, T>::value,
|
||||||
T*
|
T*
|
||||||
>::type
|
>::type
|
||||||
up_cast(SGWeakReferenced* ptr);
|
up_cast(SGWeakReferenced* ptr);
|
||||||
@ -130,8 +123,8 @@ private:
|
|||||||
/// Upcast in a non-virtual class hierarchy
|
/// Upcast in a non-virtual class hierarchy
|
||||||
template<class T>
|
template<class T>
|
||||||
static
|
static
|
||||||
typename boost::disable_if<
|
typename std::enable_if<
|
||||||
boost::is_base_of<SGVirtualWeakReferenced, T>,
|
!std::is_base_of<SGVirtualWeakReferenced, T>::value,
|
||||||
T*
|
T*
|
||||||
>::type
|
>::type
|
||||||
up_cast(SGWeakReferenced* ptr)
|
up_cast(SGWeakReferenced* ptr)
|
||||||
@ -185,8 +178,8 @@ class SGVirtualWeakReferenced:
|
|||||||
/// Upcast in a class hierarchy with a virtual base class
|
/// Upcast in a class hierarchy with a virtual base class
|
||||||
// We (clang) need the definition of SGVirtualWeakReferenced for the static_cast
|
// We (clang) need the definition of SGVirtualWeakReferenced for the static_cast
|
||||||
template<class T>
|
template<class T>
|
||||||
typename boost::enable_if<
|
typename std::enable_if<
|
||||||
boost::is_base_of<SGVirtualWeakReferenced, T>,
|
std::is_base_of<SGVirtualWeakReferenced, T>::value,
|
||||||
T*
|
T*
|
||||||
>::type
|
>::type
|
||||||
SGWeakReferenced::WeakData::up_cast(SGWeakReferenced* ptr)
|
SGWeakReferenced::WeakData::up_cast(SGWeakReferenced* ptr)
|
||||||
|
Loading…
Reference in New Issue
Block a user