// Copyright Cromwell D. Enage 2018. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PARAMETER_AUGMENT_PREDICATE_HPP #define BOOST_PARAMETER_AUGMENT_PREDICATE_HPP #include #include #include #include #include #include #include namespace boost { namespace parameter { namespace aux { template struct augment_predicate_check_consume_ref : ::boost::mpl::eval_if< ::boost::is_scalar , ::boost::mpl::true_ , ::boost::mpl::eval_if< ::boost::is_same< typename Tag::qualifier , ::boost::parameter::consume_reference > , ::boost::mpl::if_< ::boost::is_lvalue_reference , ::boost::mpl::false_ , ::boost::mpl::true_ > , boost::mpl::true_ > >::type { }; }}} // namespace boost::parameter::aux #include namespace boost { namespace parameter { namespace aux { template struct augment_predicate_check_out_ref : ::boost::mpl::eval_if< ::boost::is_same< typename Tag::qualifier , ::boost::parameter::out_reference > , ::boost::mpl::eval_if< ::boost::is_lvalue_reference , ::boost::mpl::if_< ::boost::is_const , ::boost::mpl::false_ , ::boost::mpl::true_ > , ::boost::mpl::false_ > , ::boost::mpl::true_ >::type { }; }}} // namespace boost::parameter::aux #include #include #include namespace boost { namespace parameter { namespace aux { template < typename Predicate , typename R , typename Tag , typename T , typename Args > class augment_predicate { typedef typename ::boost::mpl::lambda< Predicate , ::boost::parameter::aux::lambda_tag >::type _actual_predicate; public: typedef typename ::boost::mpl::eval_if< typename ::boost::mpl::if_< ::boost::parameter::aux ::augment_predicate_check_consume_ref , ::boost::parameter::aux ::augment_predicate_check_out_ref , ::boost::mpl::false_ >::type , ::boost::mpl::apply_wrap2<_actual_predicate,T,Args> , ::boost::mpl::false_ >::type type; }; }}} // namespace boost::parameter::aux #include #if defined(BOOST_PARAMETER_CAN_USE_MP11) #include #include #include namespace boost { namespace parameter { namespace aux { template using augment_predicate_check_consume_ref_mp11 = ::boost::mp11::mp_if< ::std::is_scalar , ::boost::mp11::mp_true , ::boost::mp11::mp_if< ::std::is_same< typename Tag::qualifier , ::boost::parameter::consume_reference > , ::boost::mp11::mp_if< ::std::is_lvalue_reference , ::boost::mp11::mp_false , ::boost::mp11::mp_true > , boost::mp11::mp_true > >; template using augment_predicate_check_out_ref_mp11 = ::boost::mp11::mp_if< ::std::is_same< typename Tag::qualifier , ::boost::parameter::out_reference > , ::boost::mp11::mp_if< ::std::is_lvalue_reference , ::boost::mp11::mp_if< ::std::is_const , ::boost::mp11::mp_false , ::boost::mp11::mp_true > , ::boost::mp11::mp_false > , ::boost::mp11::mp_true >; }}} // namespace boost::parameter::aux #include namespace boost { namespace parameter { namespace aux { template < typename Predicate , typename R , typename Tag , typename T , typename Args > struct augment_predicate_mp11_impl { using type = ::boost::mp11::mp_if< ::boost::mp11::mp_if< ::boost::parameter::aux ::augment_predicate_check_consume_ref_mp11 , ::boost::parameter::aux ::augment_predicate_check_out_ref_mp11 , ::boost::mp11::mp_false > , ::boost::mp11 ::mp_apply_q > , ::boost::mp11::mp_false >; }; }}} // namespace boost::parameter::aux #include namespace boost { namespace parameter { namespace aux { template < typename Predicate , typename R , typename Tag , typename T , typename Args > using augment_predicate_mp11 = ::boost::mp11::mp_if< ::boost::parameter::aux::has_nested_template_fn , ::boost::parameter::aux ::augment_predicate_mp11_impl , ::boost::parameter::aux ::augment_predicate >; }}} // namespace boost::parameter::aux #endif // BOOST_PARAMETER_CAN_USE_MP11 #endif // include guard