lambda: missing result deduction

I had to add this to get some tests for the TMP book to pass: namespace boost { namespace lambda { template<int N> struct plain_return_type_2<arithmetic_action<plus_action>, char[N], std::string> { typedef std::string type; }; }} // namespace boost::lambda Obviously this could be generalized for basic_string and for the reversed arguments. I assume it's not in the library because it forces you to #include <string>? Maybe there should be a special lambda header for each std:: type that needs deduction help? -- Dave Abrahams Boost Consulting http://www.boost-consulting.com

"David Abrahams" <dave@boost-consulting.com> wrote
I had to add this to get some tests for the TMP book to pass:
namespace boost { namespace lambda { template<int N> struct plain_return_type_2<arithmetic_action<plus_action>, char[N], std::string> { typedef std::string type; }; }} // namespace boost::lambda
Obviously this could be generalized for basic_string and for the reversed arguments.
The binary_operation version would look something like this with the its new enable_if functionality Zounds! this enable_if is Fun :-) ... perhaps could be done in Lambda?, template <typename L, typename R> struct binary_operation< L,std::plus,R, typename boost::enable_if< boost::mpl::and_< boost::mpl::or_< is_string<L>, is_string<R> >, is_string_concatable<L>, is_string_concatable<R>, boost::is_same< typename pqs::meta::to_value_type<L>::type, typename pqs::meta::to_value_type<R>::type > > >::type >{ typedef typename boost::mpl::if_< is_string<L>, L, R >::type result_type; }; regards Andy Little
participants (2)
-
Andy Little
-
David Abrahams