Struct _byref
boost::proto::_byref — A unary callable PolymorphicFunctionObject that wraps its argument
in a boost::reference_wrapper<>.
Synopsis
struct _byref : proto::callable {
template<typename This, typename T>
struct result<This(T &)> {
typedef boost::reference_wrapper< T > const type;
};
template<typename This, typename T>
struct result<This(T)> {
typedef boost::reference_wrapper< T const > const type;
};
template<typename T>
boost::reference_wrapper< T > const operator()(T &) const;
template<typename T>
boost::reference_wrapper< T const > const operator()(T const &) const;
};
Description
Пример:
proto::terminal<int>::type i = {42};
boost::reference_wrapper<proto::terminal<int>::type> j
= proto::when<proto::_, proto::_byref(_)>()(i);
assert( boost::addressof(i) == boost::addressof(j.get()) );
_byref public member functions
- <
template<typenameT>
boost::reference_wrapper<T>constoperator()(T&t)const;
>Оберните параметр<t>в<boost::reference_wrapper<>>
Параметры: | |
Возвращение: | <boost::ref(t)> |
Броски: | Не бросят. |
- <
template<typenameT>
boost::reference_wrapper<Tconst>constoperator()(Tconst&t)const;
>Это перегруженная функция члена, предусмотренная для удобства. Он отличается от вышеуказанной функции только тем, какие аргументы он принимает.