diff -up boost_1_54_0/boost/ref.hpp\~ boost_1_54_0/boost/ref.hpp --- boost_1_54_0/boost/ref.hpp~ 2009-06-03 16:45:12.000000000 +0200 +++ boost_1_54_0/boost/ref.hpp 2013-09-13 18:16:06.472383104 +0200 @@ -11,6 +11,7 @@ #include #include #include +#include // unary_function, binary_function // // ref.hpp - ref/cref, useful helper functions @@ -28,8 +29,106 @@ namespace boost { +namespace detail +{ + template + struct reference_wrapper_base_aux + { + protected: + T &aux_get() const { + return static_cast(this)->get(); + } + }; + + template struct reference_wrapper_base {}; + + template + struct reference_wrapper_base + : public std::unary_function + {}; + + template + struct reference_wrapper_base + : public std::unary_function + {}; + + template + struct reference_wrapper_base + : public std::unary_function + , public reference_wrapper_base_aux + { + T operator()(U *u) const { + return (u->*(this->aux_get()))(); + } + T operator()(U &u) const { + return operator()(&u); + } + }; + + template + struct reference_wrapper_base + : public std::unary_function + , public reference_wrapper_base_aux + { + T operator()(const U *u) const { + return (u->*(this->aux_get()))(); + } + T operator()(const U &u) const { + return operator()(&u); + } + }; + + template + struct reference_wrapper_base + : public std::binary_function + {}; + + template + struct reference_wrapper_base + : public std::binary_function + {}; + + template + struct reference_wrapper_base + : public std::binary_function + , public reference_wrapper_base_aux + { + T operator()(U *u, V &v) const { + return (u->*(this->aux_get()))(v); + } + T operator()(U *u, const V &v) const { + return (u->*(this->aux_get()))(v); + } + T operator()(U &u, V &v) const { + return operator()(&u, &v); + } + T operator()(U &u, const V &v) const { + return operator()(&u, &v); + } + }; + + template + struct reference_wrapper_base + : public std::binary_function + , public reference_wrapper_base_aux + { + T operator()(const U *u, V &v) const { + return (u->*(this->aux_get()))(v); + } + T operator()(const U *u, const V &v) const { + return (u->*(this->aux_get()))(v); + } + T operator()(const U &u, V &v) const { + return operator()(&u, &v); + } + T operator()(const U &u, const V &v) const { + return operator()(&u, &v); + } + }; +} template class reference_wrapper + : public detail::reference_wrapper_base, T> { public: typedef T type; Diff finished. Fri Sep 13 18:22:57 2013