Boost logo

Boost :

Subject: [boost] boost_1_40_0/boost/lambda/if.hpp && merging different return types
From: Peter Foelsche (peter_foelsche_at_[hidden])
Date: 2009-12-15 18:38:49


Am I doing something wrong, or is this patch really necessary?
I'm using if_then_else_return() and the return types are different.
I'm overloading

return_type_2<other_action<ifthenelsereturn_action>, A, B>

to let the compiler deduce the correct return type.

Peter

diff -w -c ./if.hpp /users/pfoelsch/boost_1_40_0/boost/lambda/if.hpp
*** ./if.hpp Sat Jun 28 06:57:20 2008
--- /users/pfoelsch/boost_1_40_0/boost/lambda/if.hpp Tue Dec 15 15:19:50
2009
***************
*** 310,318 ****
    template<class RET, CALL_TEMPLATE_ARGS>
    RET call(CALL_FORMAL_ARGS) const {
      return (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS))
?
! detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS)
      :
! detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS);
    }
  };

--- 310,318 ----
    template<class RET, CALL_TEMPLATE_ARGS>
    RET call(CALL_FORMAL_ARGS) const {
      return (detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS))
?
! RET(detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS))
      :
! RET(detail::select(boost::tuples::get<2>(args), CALL_ACTUAL_ARGS));
    }
  };


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk