| Home | Libraries | People | FAQ | More

## Struct _byval

boost::proto::_byval — A unary callable PolymorphicFunctionObject that strips references and `boost::reference_wrapper<>` from its argument.

## Synopsis

    // In header: <boost/proto/transform/arg.hpp>

    struct _byval :  proto::callable {
      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;
    };

## Description

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 functions

1.     template<typename T> T operator()(T const & t) const;

   Parameters: |
   `t` | The object to unref
   Returns: | `t`
   Throws: | Will not throw.

2.     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.