Index: bind.hpp =================================================================== --- bind.hpp (revision 64741) +++ bind.hpp (working copy) @@ -29,6 +29,7 @@ #include #include #include +#include // Borland-specific bug, visit_each() silently fails to produce code @@ -272,6 +273,61 @@ struct logical_and; struct logical_or; +struct invalid{}; + +template +struct argresult; + +template +struct argresult,Args>{ + typedef T type; +}; + +template +struct argresult,bind_t()>{ + typedef invalid type; +}; + +template +struct argresult,bind_t(A1)>{ + typedef A1 type; +}; + +template +struct argresult,bind_t(A1 &)>{ + typedef A1 const &type; +}; + +template +struct argresult,bind_t(A1,A2)>{ + typedef A1 type; +}; + +template +struct argresult,bind_t(A1 &,A2)>{ + typedef A1 const &type; +}; + +template +struct fresult2{ + typedef typename boost::result_of::type type; +}; + +template +struct fresult2{ + typedef invalid type; +}; + +template +struct fresult2{ + typedef invalid type; +}; + +template +struct fresult2{ + typedef invalid type; +}; + template< class A1, class A2 > class list2: private storage2< A1, A2 > { private: @@ -280,6 +336,15 @@ public: + template + struct bresult{ + typedef typename fresult2< + F, + typename argresult::type, + typename argresult::type + >::type type; + }; + list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {} A1 operator[] (boost::arg<1>) const { return base_type::a1_; } @@ -349,6 +414,7 @@ } }; + template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 > { private: @@ -861,6 +927,9 @@ #ifndef BOOST_NO_VOID_RETURNS +template +struct bind_result; + template class bind_t { public: @@ -875,6 +944,7 @@ }; + #else template struct bind_t_generator Index: bind_template.hpp =================================================================== --- bind_template.hpp (revision 64741) +++ bind_template.hpp (working copy) @@ -12,104 +12,107 @@ // See http://www.boost.org/libs/bind/bind.html for documentation. // - typedef typename result_traits::type result_type; + template + struct result{ + typedef typename L::bresult::type type; + }; - result_type operator()() + typename result::type operator()() { list0 a; - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } - result_type operator()() const + typename result::type operator()() const { list0 a; - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } - template result_type operator()(A1 & a1) + template typename result::type operator()(A1 & a1) { list1 a(a1); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } - template result_type operator()(A1 & a1) const + template typename result::type operator()(A1 & a1) const { list1 a(a1); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - template result_type operator()(A1 const & a1) + template typename result::type operator()(A1 const & a1) { list1 a(a1); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } - template result_type operator()(A1 const & a1) const + template typename result::type operator()(A1 const & a1) const { list1 a(a1); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } #endif - template result_type operator()(A1 & a1, A2 & a2) + template typename result::type operator()(A1 & a1, A2 & a2) { list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } - template result_type operator()(A1 & a1, A2 & a2) const + template typename result::type operator()(A1 & a1, A2 & a2) const { list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } #if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - template result_type operator()(A1 const & a1, A2 & a2) + template typename result::type operator()(A1 const & a1, A2 & a2) { list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } - template result_type operator()(A1 const & a1, A2 & a2) const + template typename result::type operator()(A1 const & a1, A2 & a2) const { list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } - template result_type operator()(A1 & a1, A2 const & a2) + template typename result::type operator()(A1 & a1, A2 const & a2) { list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } - template result_type operator()(A1 & a1, A2 const & a2) const + template typename result::type operator()(A1 & a1, A2 const & a2) const { list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } - template result_type operator()(A1 const & a1, A2 const & a2) + template typename result::type operator()(A1 const & a1, A2 const & a2) { list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } - template result_type operator()(A1 const & a1, A2 const & a2) const + template typename result::type operator()(A1 const & a1, A2 const & a2) const { list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); + BOOST_BIND_RETURN l_(type::type>(), f_, a, 0); } #endif - +#if 0 template result_type operator()(A1 & a1, A2 & a2, A3 & a3) { list3 a(a1, a2, a3); @@ -312,7 +315,8 @@ } #endif - +#endif +#if 0 template result_type eval(A & a) { BOOST_BIND_RETURN l_(type(), f_, a, 0); @@ -322,6 +326,7 @@ { BOOST_BIND_RETURN l_(type(), f_, a, 0); } +#endif template void accept(V & v) const {