Move from boost::mem_fn to std::mem_fn

This commit is contained in:
Jason Turner 2011-09-10 14:01:05 -06:00
parent 4522ff0732
commit f4080c4c75
3 changed files with 13 additions and 13 deletions

View File

@ -39,7 +39,7 @@ namespace chaiscript
std::function<Ret (BOOST_PP_ENUM_PARAMS(n, Param))> std::function<Ret (BOOST_PP_ENUM_PARAMS(n, Param))>
bind_first(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param)), const O &o) bind_first(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param)), const O &o)
{ {
return std::bind(boost::mem_fn(f), o BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, param, std::placeholders::_)); return std::bind(std::mem_fn(f), o BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, param, std::placeholders::_));
} }
/// \brief Helper function for binding the first parameter of a const class method pointer. Used in chaiscript::fun overloads /// \brief Helper function for binding the first parameter of a const class method pointer. Used in chaiscript::fun overloads
@ -52,7 +52,7 @@ namespace chaiscript
std::function<Ret (BOOST_PP_ENUM_PARAMS(n, Param))> std::function<Ret (BOOST_PP_ENUM_PARAMS(n, Param))>
bind_first(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param)) const, const O &o) bind_first(Ret (Class::*f)(BOOST_PP_ENUM_PARAMS(n, Param)) const, const O &o)
{ {
return std::bind(boost::mem_fn(f), o BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, param, std::placeholders::_)); return std::bind(std::mem_fn(f), o BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM(n, param, std::placeholders::_));
} }
/// \brief Helper function for binding the first parameter of a function pointer. Used in chaiscript::fun overloads /// \brief Helper function for binding the first parameter of a function pointer. Used in chaiscript::fun overloads

View File

@ -228,10 +228,10 @@ namespace chaiscript
//to throw an exception in an out of bounds condition. //to throw an exception in an out of bounds condition.
m->add( m->add(
fun(std::function<typename ContainerType::reference (ContainerType *, int)> fun(std::function<typename ContainerType::reference (ContainerType *, int)>
(boost::mem_fn(static_cast<indexoper>(&ContainerType::at)))), "[]"); (std::mem_fn(static_cast<indexoper>(&ContainerType::at)))), "[]");
m->add( m->add(
fun(std::function<typename ContainerType::const_reference (const ContainerType *, int)> fun(std::function<typename ContainerType::const_reference (const ContainerType *, int)>
(boost::mem_fn(static_cast<constindexoper>(&ContainerType::at)))), "[]"); (std::mem_fn(static_cast<constindexoper>(&ContainerType::at)))), "[]");
return m; return m;
} }
@ -255,7 +255,7 @@ namespace chaiscript
template<typename ContainerType> template<typename ContainerType>
ModulePtr container_type(const std::string &/*type*/, ModulePtr m = ModulePtr(new Module())) ModulePtr container_type(const std::string &/*type*/, ModulePtr m = ModulePtr(new Module()))
{ {
m->add(fun(std::function<int (const ContainerType *)>(boost::mem_fn(&ContainerType::size))), "size"); m->add(fun(std::function<int (const ContainerType *)>(std::mem_fn(&ContainerType::size))), "size");
m->add(fun<bool (ContainerType::*)() const>(&ContainerType::empty), "empty"); m->add(fun<bool (ContainerType::*)() const>(&ContainerType::empty), "empty");
m->add(fun<void (ContainerType::*)()>(&ContainerType::clear), "clear"); m->add(fun<void (ContainerType::*)()>(&ContainerType::clear), "clear");
@ -390,7 +390,7 @@ namespace chaiscript
template<typename ContainerType> template<typename ContainerType>
ModulePtr unique_associative_container_type(const std::string &/*type*/, ModulePtr m = ModulePtr(new Module())) ModulePtr unique_associative_container_type(const std::string &/*type*/, ModulePtr m = ModulePtr(new Module()))
{ {
m->add(fun(std::function<int (const ContainerType *, const typename ContainerType::key_type &)>(boost::mem_fn(&ContainerType::count))), "count"); m->add(fun(std::function<int (const ContainerType *, const typename ContainerType::key_type &)>(std::mem_fn(&ContainerType::count))), "count");
return m; return m;
} }
@ -515,12 +515,12 @@ namespace chaiscript
typedef std::function<int (const String *, const String &, int)> find_func; typedef std::function<int (const String *, const String &, int)> find_func;
m->add(fun(find_func(boost::mem_fn(static_cast<find_func_ptr>(&String::find)))), "find"); m->add(fun(find_func(std::mem_fn(static_cast<find_func_ptr>(&String::find)))), "find");
m->add(fun(find_func(boost::mem_fn(static_cast<find_func_ptr>(&String::rfind)))), "rfind"); m->add(fun(find_func(std::mem_fn(static_cast<find_func_ptr>(&String::rfind)))), "rfind");
m->add(fun(find_func(boost::mem_fn(static_cast<find_func_ptr>(&String::find_first_of)))), "find_first_of"); m->add(fun(find_func(std::mem_fn(static_cast<find_func_ptr>(&String::find_first_of)))), "find_first_of");
m->add(fun(find_func(boost::mem_fn(static_cast<find_func_ptr>(&String::find_last_of)))), "find_last_of"); m->add(fun(find_func(std::mem_fn(static_cast<find_func_ptr>(&String::find_last_of)))), "find_last_of");
m->add(fun(find_func(boost::mem_fn(static_cast<find_func_ptr>(&String::find_first_not_of)))), "find_first_not_of"); m->add(fun(find_func(std::mem_fn(static_cast<find_func_ptr>(&String::find_first_not_of)))), "find_first_not_of");
m->add(fun(find_func(boost::mem_fn(static_cast<find_func_ptr>(&String::find_last_not_of)))), "find_last_not_of"); m->add(fun(find_func(std::mem_fn(static_cast<find_func_ptr>(&String::find_last_not_of)))), "find_last_not_of");
m->add(fun(&String::c_str), "c_str"); m->add(fun(&String::c_str), "c_str");
m->add(fun(&String::data), "data"); m->add(fun(&String::data), "data");

View File

@ -44,7 +44,7 @@ namespace chaiscript
typename boost::function_types::function_type<boost::function_types::components<T> >::type> ( typename boost::function_types::function_type<boost::function_types::components<T> >::type> (
std::function< std::function<
typename boost::function_types::function_type<boost::function_types::components<T> >::type typename boost::function_types::function_type<boost::function_types::components<T> >::type
>(boost::mem_fn(t)))); >(std::mem_fn(t))));
} }
}; };