📄 operators.hpp
字号:
///////////////////////////////////////////////////////////////////////////////
//
// invert lazy operator (prefix ~)
//
///////////////////////////////////////////////////////////////////////////////
struct invert_op {
template <typename T0>
struct result {
typedef typename unary_operator<invert_op, T0>::result_type type;
};
template <typename T0>
typename unary_operator<invert_op, T0>::result_type
operator()(T0& _0) const
{ return unary_operator<invert_op, T0>::eval(_0); }
};
//////////////////////////////////
template <typename BaseT>
inline typename impl::make_unary<invert_op, BaseT>::type
operator~(actor<BaseT> const& _0)
{
return impl::make_unary<invert_op, BaseT>::construct(_0);
}
///////////////////////////////////////////////////////////////////////////////
//
// reference lazy operator (prefix &)
//
///////////////////////////////////////////////////////////////////////////////
struct reference_op {
template <typename T0>
struct result {
typedef typename unary_operator<reference_op, T0>::result_type type;
};
template <typename T0>
typename unary_operator<reference_op, T0>::result_type
operator()(T0& _0) const
{ return unary_operator<reference_op, T0>::eval(_0); }
};
//////////////////////////////////
template <typename BaseT>
inline typename impl::make_unary<reference_op, BaseT>::type
operator&(actor<BaseT> const& _0)
{
return impl::make_unary<reference_op, BaseT>::construct(_0);
}
///////////////////////////////////////////////////////////////////////////////
//
// dereference lazy operator (prefix *)
//
///////////////////////////////////////////////////////////////////////////////
struct dereference_op {
template <typename T0>
struct result {
typedef typename unary_operator<dereference_op, T0>::result_type type;
};
template <typename T0>
typename unary_operator<dereference_op, T0>::result_type
operator()(T0& _0) const
{ return unary_operator<dereference_op, T0>::eval(_0); }
};
//////////////////////////////////
template <typename BaseT>
inline typename impl::make_unary<dereference_op, BaseT>::type
operator*(actor<BaseT> const& _0)
{
return impl::make_unary<dereference_op, BaseT>::construct(_0);
}
///////////////////////////////////////////////////////////////////////////////
//
// pre increment lazy operator (prefix ++)
//
///////////////////////////////////////////////////////////////////////////////
struct pre_incr_op {
template <typename T0>
struct result {
typedef typename unary_operator<pre_incr_op, T0>::result_type type;
};
template <typename T0>
typename unary_operator<pre_incr_op, T0>::result_type
operator()(T0& _0) const
{ return unary_operator<pre_incr_op, T0>::eval(_0); }
};
//////////////////////////////////
template <typename BaseT>
inline typename impl::make_unary<pre_incr_op, BaseT>::type
operator++(actor<BaseT> const& _0)
{
return impl::make_unary<pre_incr_op, BaseT>::construct(_0);
}
///////////////////////////////////////////////////////////////////////////////
//
// pre decrement lazy operator (prefix --)
//
///////////////////////////////////////////////////////////////////////////////
struct pre_decr_op {
template <typename T0>
struct result {
typedef typename unary_operator<pre_decr_op, T0>::result_type type;
};
template <typename T0>
typename unary_operator<pre_decr_op, T0>::result_type
operator()(T0& _0) const
{ return unary_operator<pre_decr_op, T0>::eval(_0); }
};
//////////////////////////////////
template <typename BaseT>
inline typename impl::make_unary<pre_decr_op, BaseT>::type
operator--(actor<BaseT> const& _0)
{
return impl::make_unary<pre_decr_op, BaseT>::construct(_0);
}
///////////////////////////////////////////////////////////////////////////////
//
// post increment lazy operator (postfix ++)
//
///////////////////////////////////////////////////////////////////////////////
struct post_incr_op {
template <typename T0>
struct result {
typedef typename unary_operator<post_incr_op, T0>::result_type type;
};
template <typename T0>
typename unary_operator<post_incr_op, T0>::result_type
operator()(T0& _0) const
{ return unary_operator<post_incr_op, T0>::eval(_0); }
};
//////////////////////////////////
template <typename BaseT>
inline typename impl::make_unary<post_incr_op, BaseT>::type
operator++(actor<BaseT> const& _0, int)
{
return impl::make_unary<post_incr_op, BaseT>::construct(_0);
}
///////////////////////////////////////////////////////////////////////////////
//
// post decrement lazy operator (postfix --)
//
///////////////////////////////////////////////////////////////////////////////
struct post_decr_op {
template <typename T0>
struct result {
typedef typename unary_operator<post_decr_op, T0>::result_type type;
};
template <typename T0>
typename unary_operator<post_decr_op, T0>::result_type
operator()(T0& _0) const
{ return unary_operator<post_decr_op, T0>::eval(_0); }
};
//////////////////////////////////
template <typename BaseT>
inline typename impl::make_unary<post_decr_op, BaseT>::type
operator--(actor<BaseT> const& _0, int)
{
return impl::make_unary<post_decr_op, BaseT>::construct(_0);
}
///////////////////////////////////////////////////////////////////////////////
//
// assignment lazy operator (infix =)
// The acual lazy operator is a member of the actor class.
//
///////////////////////////////////////////////////////////////////////////////
struct assign_op {
template <typename T0, typename T1>
struct result {
typedef typename binary_operator<assign_op, T0, T1>
::result_type type;
};
template <typename T0, typename T1>
typename binary_operator<assign_op, T0, T1>::result_type
operator()(T0& _0, T1& _1) const
{ return binary_operator<assign_op, T0, T1>::eval(_0, _1); }
};
//////////////////////////////////
template <typename BaseT>
template <typename B>
inline typename impl::make_binary1<assign_op, BaseT, B>::type
actor<BaseT>::operator=(B const& _1) const
{
return impl::make_binary1<assign_op, BaseT, B>::construct(*this, _1);
}
///////////////////////////////////////////////////////////////////////////////
//
// index lazy operator (array index [])
// The acual lazy operator is a member of the actor class.
//
///////////////////////////////////////////////////////////////////////////////
struct index_op {
template <typename T0, typename T1>
struct result {
typedef typename binary_operator<index_op, T0, T1>
::result_type type;
};
template <typename T0, typename T1>
typename binary_operator<index_op, T0, T1>::result_type
operator()(T0& _0, T1& _1) const
{ return binary_operator<index_op, T0, T1>::eval(_0, _1); }
};
//////////////////////////////////
template <typename BaseT>
template <typename B>
inline typename impl::make_binary1<index_op, BaseT, B>::type
actor<BaseT>::operator[](B const& _1) const
{
return impl::make_binary1<index_op, BaseT, B>::construct(*this, _1);
}
///////////////////////////////////////////////////////////////////////////////
//
// plus assign lazy operator (infix +=)
//
///////////////////////////////////////////////////////////////////////////////
struct plus_assign_op {
template <typename T0, typename T1>
struct result {
typedef typename binary_operator<plus_assign_op, T0, T1>
::result_type type;
};
template <typename T0, typename T1>
typename binary_operator<plus_assign_op, T0, T1>::result_type
operator()(T0& _0, T1& _1) const
{ return binary_operator<plus_assign_op, T0, T1>::eval(_0, _1); }
};
//////////////////////////////////
template <typename BaseT, typename T1>
inline typename impl::make_binary1<plus_assign_op, BaseT, T1>::type
operator+=(actor<BaseT> const& _0, T1 CREF _1)
{
return impl::make_binary1<plus_assign_op, BaseT, T1>::construct(_0, _1);
}
///////////////////////////////////////////////////////////////////////////////
//
// minus assign lazy operator (infix -=)
//
///////////////////////////////////////////////////////////////////////////////
struct minus_assign_op {
template <typename T0, typename T1>
struct result {
typedef typename binary_operator<minus_assign_op, T0, T1>
::result_type type;
};
template <typename T0, typename T1>
typename binary_operator<minus_assign_op, T0, T1>::result_type
operator()(T0& _0, T1& _1) const
{ return binary_operator<minus_assign_op, T0, T1>::eval(_0, _1); }
};
//////////////////////////////////
template <typename BaseT, typename T1>
inline typename impl::make_binary1<minus_assign_op, BaseT, T1>::type
operator-=(actor<BaseT> const& _0, T1 CREF _1)
{
return impl::make_binary1<minus_assign_op, BaseT, T1>::construct(_0, _1);
}
///////////////////////////////////////////////////////////////////////////////
//
// times assign lazy operator (infix *=)
//
///////////////////////////////////////////////////////////////////////////////
struct times_assign_op {
template <typename T0, typename T1>
struct result {
typedef typename binary_operator<times_assign_op, T0, T1>
::result_type type;
};
template <typename T0, typename T1>
typename binary_operator<times_assign_op, T0, T1>::result_type
operator()(T0& _0, T1& _1) const
{ return binary_operator<times_assign_op, T0, T1>::eval(_0, _1); }
};
//////////////////////////////////
template <typename BaseT, typename T1>
inline typename impl::make_binary1<times_assign_op, BaseT, T1>::type
operator*=(actor<BaseT> const& _0, T1 CREF _1)
{
return impl::make_binary1<times_assign_op, BaseT, T1>::construct(_0, _1);
}
///////////////////////////////////////////////////////////////////////////////
//
// divide assign lazy operator (infix /=)
//
///////////////////////////////////////////////////////////////////////////////
struct divide_assign_op {
template <typename T0, typename T1>
struct result {
typedef typename binary_operator<divide_assign_op, T0, T1>
::result_type type;
};
template <typename T0, typename T1>
typename binary_operator<divide_assign_op, T0, T1>::result_type
operator()(T0& _0, T1& _1) const
{ return binary_operator<divide_assign_op, T0, T1>::eval(_0, _1); }
};
//////////////////////////////////
template <typename BaseT, typename T1>
inline typename impl::make_binary1<divide_assign_op, BaseT, T1>::type
operator/=(actor<BaseT> const& _0, T1 CREF _1)
{
return impl::make_binary1<divide_assign_op, BaseT, T1>::construct(_0, _1);
}
///////////////////////////////////////////////////////////////////////////////
//
// mod assign lazy operator (infix %=)
//
///////////////////////////////////////////////////////////////////////////////
struct mod_assign_op {
template <typename T0, typename T1>
struct result {
typedef typename binary_operator<mod_assign_op, T0, T1>
::result_type type;
};
template <typename T0, typename T1>
typename binary_operator<mod_assign_op, T0, T1>::result_type
operator()(T0& _0, T1& _1) const
{ return binary_operator<mod_assign_op, T0, T1>::eval(_0, _1); }
};
//////////////////////////////////
template <typename BaseT, typename T1>
inline typename impl::make_binary1<mod_assign_op, BaseT, T1>::type
operator%=(actor<BaseT> const& _0, T1 CREF _1)
{
return impl::make_binary1<mod_assign_op, BaseT, T1>::construct(_0, _1);
}
///////////////////////////////////////////////////////////////////////////////
//
// and assign lazy operator (infix &=)
//
///////////////////////////////////////////////////////////////////////////////
struct and_assign_op {
template <typename T0, typename T1>
struct result {
typedef typename binary_operator<and_assign_op, T0, T1>
::result_type type;
};
template <typename T0, typename T1>
typename binary_operator<and_assign_op, T0, T1>::result_type
operator()(T0& _0, T1& _1) const
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -