...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::proto::_byval —
A unary callable PolymorphicFunctionObject that strips references and
boost::reference_wrapper<>
from its argument.
// In header: <boost/proto/transform/arg.hpp> struct _byval : proto::callable { // member classes/structs/unions template<typename This, typename T> struct result<This(boost::reference_wrapper< T >)> : result<This(T)> { }; template<typename This, typename T> struct result<This(T &)> : result<This(T)> { }; template<typename This, typename T> struct result<This(T)> { // types typedef T type; }; // public member functions template<typename T> T operator()(T const &) const; template<typename T> T operator()(boost::reference_wrapper< T > const &) const; };
Example:
proto::terminal<int>::type i = {42}; int j = 67; int k = proto::when<proto::_, proto::_byval(proto::_state)>()(i, boost::ref(j)); assert( 67 == k );
_byval
public member functionstemplate<typename T> T operator()(T const & t) const;
Parameters: |
|
||
Returns: |
|
||
Throws: |
Will not throw. |
template<typename T> T operator()(boost::reference_wrapper< T > const & t) const;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.