diff --git a/include/boost/bind.hpp b/include/boost/bind.hpp index ec2ac5b..8d3beb4 100644 --- a/include/boost/bind.hpp +++ b/include/boost/bind.hpp @@ -28,6 +28,26 @@ namespace boost namespace _bi // implementation details { +// result_traits + +template struct result_traits +{ + typedef R type; +}; + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +struct unspecified {}; + +template struct result_traits +{ + typedef typename F::result_type type; +}; + +#endif + +// bind_t forward declaration for listN + template class bind_t; // value @@ -69,9 +89,9 @@ public: template T & operator[] (reference_wrapper const & v) const { return v.get(); } - template R operator[] (bind_t & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - template R operator[] (bind_t const & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F f, A & /* a */) const { @@ -101,9 +121,9 @@ public: template T & operator[] (reference_wrapper const & v) const { return v.get(); } - template R operator[] (bind_t & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - template R operator[] (bind_t const & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F f, A & a) const { @@ -137,9 +157,9 @@ public: template T & operator[] (reference_wrapper const & v) const { return v.get(); } - template R operator[] (bind_t & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - template R operator[] (bind_t const & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F f, A & a) const { @@ -176,9 +196,9 @@ public: template T & operator[] (reference_wrapper const & v) const { return v.get(); } - template R operator[] (bind_t & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - template R operator[] (bind_t const & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F f, A & a) const { @@ -218,9 +238,9 @@ public: template T & operator[] (reference_wrapper const & v) const { return v.get(); } - template R operator[] (bind_t & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - template R operator[] (bind_t const & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F f, A & a) const { @@ -263,9 +283,9 @@ public: template T & operator[] (reference_wrapper const & v) const { return v.get(); } - template R operator[] (bind_t & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - template R operator[] (bind_t const & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F f, A & a) const { @@ -311,9 +331,9 @@ public: template T & operator[] (reference_wrapper const & v) const { return v.get(); } - template R operator[] (bind_t & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - template R operator[] (bind_t const & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F f, A & a) const { @@ -362,9 +382,9 @@ public: template T & operator[] (reference_wrapper const & v) const { return v.get(); } - template R operator[] (bind_t & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - template R operator[] (bind_t const & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F f, A & a) const { @@ -416,9 +436,9 @@ public: template T & operator[] (reference_wrapper const & v) const { return v.get(); } - template R operator[] (bind_t & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - template R operator[] (bind_t const & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F f, A & a) const { @@ -473,9 +493,9 @@ public: template T & operator[] (reference_wrapper const & v) const { return v.get(); } - template R operator[] (bind_t & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - template R operator[] (bind_t const & b) const { return b.eval(*this); } + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F f, A & a) const { @@ -510,40 +530,14 @@ private: list9 & operator= (list9 const &); }; -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - -// unspecified - -struct unspecified {}; - -template struct result_traits -{ - typedef R type; -}; - -template struct result_traits -{ - typedef typename F::result_type type; -}; - -#endif - // bind_t template class bind_t { public: -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - typedef typename result_traits::type result_type; -#else - - typedef R result_type; - -#endif - bind_t(F f, L const & l): f_(f), l_(l) {} result_type operator()()