Move from boost::type_traits to std::type_traits

This commit is contained in:
Jason Turner 2011-09-10 13:18:29 -06:00
parent 62cf6293e8
commit b297162d13
10 changed files with 36 additions and 52 deletions

View File

@ -148,10 +148,10 @@ namespace chaiscript
* Specific version of shared_ptr_clone just for Proxy_Functions
*/
template<typename Type>
std::shared_ptr<typename boost::remove_const<Type>::type>
shared_ptr_unconst_clone(const std::shared_ptr<typename boost::add_const<Type>::type> &p)
std::shared_ptr<typename std::remove_const<Type>::type>
shared_ptr_unconst_clone(const std::shared_ptr<typename std::add_const<Type>::type> &p)
{
return std::const_pointer_cast<typename boost::remove_const<Type>::type>(p);
return std::const_pointer_cast<typename std::remove_const<Type>::type>(p);
}
@ -466,8 +466,8 @@ namespace chaiscript
"bind");
m->add(fun(&shared_ptr_unconst_clone<dispatch::Proxy_Function_Base>), "clone");
m->add(fun(&ptr_assign<boost::remove_const<dispatch::Proxy_Function_Base>::type>), "=");
m->add(fun(&ptr_assign<boost::add_const<dispatch::Proxy_Function_Base>::type>), "=");
m->add(fun(&ptr_assign<std::remove_const<dispatch::Proxy_Function_Base>::type>), "=");
m->add(fun(&ptr_assign<std::add_const<dispatch::Proxy_Function_Base>::type>), "=");
m->add(Proxy_Function(new dispatch::Dynamic_Proxy_Function(std::bind(&call_exists, std::placeholders::_1))),
"call_exists");

View File

@ -14,9 +14,6 @@
#include "../chaiscript_threading.hpp"
#include <boost/any.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/is_polymorphic.hpp>
#include <boost/integer_traits.hpp>
namespace chaiscript
{
@ -77,7 +74,7 @@ namespace chaiscript
#pragma warning(disable : 4127)
#endif
if (boost::is_polymorphic<typename detail::Stripped_Type<Type>::type>::value)
if (std::is_polymorphic<typename detail::Stripped_Type<Type>::type>::value)
{
try {
// We will not catch any bad_boxed_dynamic_cast that is thrown, let the user get it

View File

@ -11,7 +11,6 @@
#include "boxed_value.hpp"
#include <boost/any.hpp>
#include <boost/type_traits/add_const.hpp>
namespace chaiscript
{
@ -25,7 +24,7 @@ namespace chaiscript
template<typename Result>
struct Cast_Helper_Inner
{
typedef typename std::reference_wrapper<typename boost::add_const<Result>::type > Result_Type;
typedef typename std::reference_wrapper<typename std::add_const<Result>::type > Result_Type;
static Result_Type cast(const Boxed_Value &ob)
{

View File

@ -13,8 +13,6 @@
#include <map>
#include <boost/any.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/integer_traits.hpp>
namespace chaiscript
{
@ -296,7 +294,7 @@ namespace chaiscript
template<typename T>
Boxed_Value const_var_impl(const T &t)
{
return Boxed_Value(std::shared_ptr<typename boost::add_const<T>::type >(new T(t)));
return Boxed_Value(std::shared_ptr<typename std::add_const<T>::type >(new T(t)));
}
/// \brief Takes a pointer to a value, adds const to the pointed to type and returns an immutable Boxed_Value.
@ -307,7 +305,7 @@ namespace chaiscript
template<typename T>
Boxed_Value const_var_impl(T *t)
{
return Boxed_Value( const_cast<typename boost::add_const<T>::type *>(t) );
return Boxed_Value( const_cast<typename std::add_const<T>::type *>(t) );
}
/// \brief Takes a std::shared_ptr to a value, adds const to the pointed to type and returns an immutable Boxed_Value.
@ -318,7 +316,7 @@ namespace chaiscript
template<typename T>
Boxed_Value const_var_impl(const std::shared_ptr<T> &t)
{
return Boxed_Value( std::const_pointer_cast<typename boost::add_const<T>::type>(t) );
return Boxed_Value( std::const_pointer_cast<typename std::add_const<T>::type>(t) );
}
/// \brief Takes a std::reference_wrapper value, adds const to the referenced type and returns an immutable Boxed_Value.

View File

@ -12,8 +12,6 @@
#include "boxed_cast_helper.hpp"
#include "bad_boxed_cast.hpp"
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_polymorphic.hpp>
#include <boost/type_traits/is_base_of.hpp>
namespace chaiscript
{
@ -249,9 +247,9 @@ namespace chaiscript
{
//Can only be used with related polymorphic types
//may be expanded some day to support conversions other than child -> parent
BOOST_STATIC_ASSERT((boost::is_base_of<Base,Derived>::value));
BOOST_STATIC_ASSERT(boost::is_polymorphic<Base>::value);
BOOST_STATIC_ASSERT(boost::is_polymorphic<Derived>::value);
BOOST_STATIC_ASSERT((std::is_base_of<Base,Derived>::value));
BOOST_STATIC_ASSERT(std::is_polymorphic<Base>::value);
BOOST_STATIC_ASSERT(std::is_polymorphic<Derived>::value);
return detail::Dynamic_Conversions::create<Base, Derived>();
}

View File

@ -6,7 +6,7 @@
#include <boost/preprocessor.hpp>
#define addparam(z,n,text) params.push_back((boost::is_reference<Param ## n>::value&&!(boost::is_same<chaiscript::Boxed_Value, typename boost::remove_const<typename boost::remove_reference<Param ## n>::type>::type>::value))?Boxed_Value(std::ref(BOOST_PP_CAT(p, n))):Boxed_Value(BOOST_PP_CAT(p, n) ));
#define addparam(z,n,text) params.push_back((std::is_reference<Param ## n>::value&&!(std::is_same<chaiscript::Boxed_Value, typename std::remove_const<typename std::remove_reference<Param ## n>::type>::type>::value))?Boxed_Value(std::ref(BOOST_PP_CAT(p, n))):Boxed_Value(BOOST_PP_CAT(p, n) ));
#define curry(z,n,text) BOOST_PP_CAT(std::placeholders::_, BOOST_PP_INC(n))

View File

@ -12,7 +12,7 @@
#include "boxed_value.hpp"
#include "type_info.hpp"
#include <string>
#include <boost/type_traits/add_reference.hpp>
#include <type_traits>
#include <stdexcept>
#include <vector>
#include "proxy_functions_detail.hpp"
@ -554,10 +554,10 @@ namespace chaiscript
if (bv.is_const())
{
const Class *o = boxed_cast<const Class *>(bv);
return detail::Handle_Return<typename boost::add_reference<T>::type>::handle(o->*m_attr);
return detail::Handle_Return<typename std::add_lvalue_reference<T>::type>::handle(o->*m_attr);
} else {
Class *o = boxed_cast<Class *>(bv);
return detail::Handle_Return<typename boost::add_reference<T>::type>::handle(o->*m_attr);
return detail::Handle_Return<typename std::add_lvalue_reference<T>::type>::handle(o->*m_attr);
}
} else {
throw exception::arity_error(static_cast<int>(params.size()), 1);

View File

@ -10,15 +10,7 @@
#include <string>
#include <typeinfo>
#include <memory>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_void.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_arithmetic.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <type_traits>
namespace chaiscript
{
@ -28,7 +20,7 @@ namespace chaiscript
template<typename T>
struct Bare_Type
{
typedef typename boost::remove_const<typename boost::remove_pointer<typename boost::remove_reference<T>::type>::type>::type type;
typedef typename std::remove_const<typename std::remove_pointer<typename std::remove_reference<T>::type>::type>::type type;
};
}
@ -147,9 +139,9 @@ namespace chaiscript
static Type_Info get()
{
return Type_Info(boost::is_const<typename boost::remove_pointer<typename boost::remove_reference<T>::type>::type>::value, boost::is_reference<T>::value, boost::is_pointer<T>::value,
boost::is_void<T>::value,
boost::is_arithmetic<T>::value && !boost::is_same<typename boost::remove_const<T>::type, bool>::value,
return Type_Info(std::is_const<typename std::remove_pointer<typename std::remove_reference<T>::type>::type>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
std::is_void<T>::value,
std::is_arithmetic<T>::value && !std::is_same<typename std::remove_const<T>::type, bool>::value,
&typeid(T),
&typeid(typename Bare_Type<T>::type));
}
@ -162,9 +154,9 @@ namespace chaiscript
static Type_Info get()
{
return Type_Info(boost::is_const<T>::value, boost::is_reference<T>::value, boost::is_pointer<T>::value,
boost::is_void<T>::value,
boost::is_arithmetic<T>::value && !boost::is_same<typename boost::remove_const<T>::type, bool>::value,
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
std::is_void<T>::value,
std::is_arithmetic<T>::value && !std::is_same<typename std::remove_const<T>::type, bool>::value,
&typeid(std::shared_ptr<T> ),
&typeid(typename Bare_Type<T>::type));
}
@ -177,9 +169,9 @@ namespace chaiscript
static Type_Info get()
{
return Type_Info(boost::is_const<T>::value, boost::is_reference<T>::value, boost::is_pointer<T>::value,
boost::is_void<T>::value,
boost::is_arithmetic<T>::value && !boost::is_same<typename boost::remove_const<T>::type, bool>::value,
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
std::is_void<T>::value,
std::is_arithmetic<T>::value && !std::is_same<typename std::remove_const<T>::type, bool>::value,
&typeid(const std::shared_ptr<T> &),
&typeid(typename Bare_Type<T>::type));
}
@ -192,9 +184,9 @@ namespace chaiscript
static Type_Info get()
{
return Type_Info(boost::is_const<T>::value, boost::is_reference<T>::value, boost::is_pointer<T>::value,
boost::is_void<T>::value,
boost::is_arithmetic<T>::value && !boost::is_same<typename boost::remove_const<T>::type, bool>::value,
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
std::is_void<T>::value,
std::is_arithmetic<T>::value && !std::is_same<typename std::remove_const<T>::type, bool>::value,
&typeid(std::reference_wrapper<T> ),
&typeid(typename Bare_Type<T>::type));
}
@ -207,9 +199,9 @@ namespace chaiscript
static Type_Info get()
{
return Type_Info(boost::is_const<T>::value, boost::is_reference<T>::value, boost::is_pointer<T>::value,
boost::is_void<T>::value,
boost::is_arithmetic<T>::value && !boost::is_same<typename boost::remove_const<T>::type, bool>::value,
return Type_Info(std::is_const<T>::value, std::is_reference<T>::value, std::is_pointer<T>::value,
std::is_void<T>::value,
std::is_arithmetic<T>::value && !std::is_same<typename std::remove_const<T>::type, bool>::value,
&typeid(const std::reference_wrapper<T> &),
&typeid(typename Bare_Type<T>::type));
}

View File

@ -80,7 +80,7 @@ std::string get_next_command() {
char *input_raw = readline("eval> ");
if ( input_raw ) {
add_history(input_raw);
retval = boost::trim_copy_if(std::string(input_raw),boost::is_any_of(" \t"));
retval = boost::trim_copy_if(std::string(input_raw),boost::algorithm::is_any_of(" \t"));
::free(input_raw);
}
}

View File

@ -46,7 +46,7 @@ bool test_type_conversion(const Boxed_Value &bv, bool expectedpass)
std::cerr << "Error with type conversion test. From: "
<< (bv.is_const()?(std::string("const ")):(std::string())) << bv.get_type_info().name()
<< " To: "
<< (boost::is_const<To>::value?(std::string("const ")):(std::string())) << typeid(To).name()
<< (std::is_const<To>::value?(std::string("const ")):(std::string())) << typeid(To).name()
<< " test was expected to " << ((expectedpass)?(std::string("succeed")):(std::string("fail"))) << " but did not" << std::endl;
}