⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 operators.hpp

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 HPP
📖 第 1 页 / 共 2 页
字号:
                       T&,                       typename const_copy_argument <T>::type                     >::RET type;};template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default {  typedef typename detail::IF<                       is_instance_of_2<                         T, std::basic_istream                       >::value,                       T&,                       typename const_copy_argument <T>::type                     >::RET type;};#endif} // detailBOOST_LAMBDA_BE2(operator<<, bitwise_action< leftshift_action>, A, const B, detail::convert_ostream_to_ref_others_to_c_plain_by_default)BOOST_LAMBDA_BE2(operator>>, bitwise_action< rightshift_action>, A, const B, detail::convert_istream_to_ref_others_to_c_plain_by_default)      // special case for io_manipulators.// function references cannot be given as arguments to lambda operator// expressions in general. With << and >> the use of manipulators is// so common, that specializations are provided to make them work.template<class Arg, class Ret, class ManipArg>inline const lambda_functor<  lambda_functor_base<    bitwise_action<leftshift_action>,    tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>   > >operator<<(const lambda_functor<Arg>& a, Ret(&b)(ManipArg)){  return       lambda_functor_base<        bitwise_action<leftshift_action>,        tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>      >     ( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) );}template<class Arg, class Ret, class ManipArg>inline const lambda_functor<  lambda_functor_base<    bitwise_action<rightshift_action>,    tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>  > >operator>>(const lambda_functor<Arg>& a, Ret(&b)(ManipArg)){  return       lambda_functor_base<        bitwise_action<rightshift_action>,        tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>      >     ( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) );}// (+ and -) take their arguments as const references. // This has consquences with pointer artihmetic// E.g int a[]; ... *a = 1 works but not *(a+1) = 1. // the result of a+1 would be const// To make the latter work too, // non-const arrays are taken as non-const and stored as non-const as well.#if defined  BOOST_LAMBDA_PTR_ARITHMETIC_E1#error "Multiple defines of  BOOST_LAMBDA_PTR_ARITHMETIC_E1"#endif#define BOOST_LAMBDA_PTR_ARITHMETIC_E1(OPER_NAME, ACTION, CONSTB)            \template<class Arg, int N, class B>                                         \inline const                                                                \lambda_functor<                                                             \  lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> >   \>                                                                           \OPER_NAME (const lambda_functor<Arg>& a, CONSTB(&b)[N])                    \{                                                                           \  return lambda_functor<                                                    \    lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> > \  >(tuple<lambda_functor<Arg>, CONSTB(&)[N]>(a, b));                       \}#if defined  BOOST_LAMBDA_PTR_ARITHMETIC_E2#error "Multiple defines of  BOOST_LAMBDA_PTR_ARITHMETIC_E2"#endif#define BOOST_LAMBDA_PTR_ARITHMETIC_E2(OPER_NAME, ACTION, CONSTA)             \template<int N, class A, class Arg>                                          \inline const                                                                 \lambda_functor<                                                              \  lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > >   \>                                                                            \OPER_NAME (CONSTA(&a)[N], const lambda_functor<Arg>& b)                     \{                                                                            \  return                                                                     \    lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > > \    (tuple<CONSTA(&)[N], lambda_functor<Arg> >(a, b));                      \}BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>, B)BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>, A)BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>,const B)BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>,const A)//BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator-, arithmetic_action<minus_action>)// This is not needed, since the result of ptr-ptr is an rvalue anywayBOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, A)BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, const A)#undef BOOST_LAMBDA_BE1#undef BOOST_LAMBDA_BE2#undef BOOST_LAMBDA_BE3#undef BOOST_LAMBDA_BE#undef BOOST_LAMBDA_COMMA_OPERATOR_NAME#undef BOOST_LAMBDA_PTR_ARITHMETIC_E1#undef BOOST_LAMBDA_PTR_ARITHMETIC_E2// ---------------------------------------------------------------------// unary operators -----------------------------------------------------// ---------------------------------------------------------------------#if defined BOOST_LAMBDA_UE#error "Multiple defines of BOOST_LAMBDA_UE"#endif#define BOOST_LAMBDA_UE(OPER_NAME, ACTION)                                 \template<class Arg>                                                        \inline const                                                               \lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \OPER_NAME (const lambda_functor<Arg>& a)                                   \{                                                                          \  return                                                                   \    lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > >              \    ( tuple<lambda_functor<Arg> >(a) );                                    \}BOOST_LAMBDA_UE(operator+, unary_arithmetic_action<plus_action>)BOOST_LAMBDA_UE(operator-, unary_arithmetic_action<minus_action>)BOOST_LAMBDA_UE(operator~, bitwise_action<not_action>)BOOST_LAMBDA_UE(operator!, logical_action<not_action>)BOOST_LAMBDA_UE(operator++, pre_increment_decrement_action<increment_action>)BOOST_LAMBDA_UE(operator--, pre_increment_decrement_action<decrement_action>)BOOST_LAMBDA_UE(operator*, other_action<contentsof_action>)BOOST_LAMBDA_UE(operator&, other_action<addressof_action>)#if defined BOOST_LAMBDA_POSTFIX_UE#error "Multiple defines of BOOST_LAMBDA_POSTFIX_UE"#endif#define BOOST_LAMBDA_POSTFIX_UE(OPER_NAME, ACTION)                         \template<class Arg>                                                        \inline const                                                               \lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \OPER_NAME (const lambda_functor<Arg>& a, int)                              \{                                                                          \  return                                                                   \    lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > >              \    ( tuple<lambda_functor<Arg> >(a) );                                    \}BOOST_LAMBDA_POSTFIX_UE(operator++, post_increment_decrement_action<increment_action>)BOOST_LAMBDA_POSTFIX_UE(operator--, post_increment_decrement_action<decrement_action>)#undef BOOST_LAMBDA_UE#undef BOOST_LAMBDA_POSTFIX_UE} // namespace lambda} // namespace boost#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -