File indexing completed on 2025-01-30 09:43:52
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_HOF_GUARD_ROTATE_H
0009 #define BOOST_HOF_GUARD_ROTATE_H
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 #include <boost/hof/detail/result_of.hpp>
0052 #include <boost/hof/reveal.hpp>
0053 #include <boost/hof/detail/make.hpp>
0054 #include <boost/hof/detail/static_const_var.hpp>
0055
0056 namespace boost { namespace hof {
0057
0058 template<class F>
0059 struct rotate_adaptor : detail::callable_base<F>
0060 {
0061 typedef rotate_adaptor fit_rewritable1_tag;
0062 BOOST_HOF_INHERIT_CONSTRUCTOR(rotate_adaptor, detail::callable_base<F>);
0063
0064 template<class... Ts>
0065 constexpr const detail::callable_base<F>& base_function(Ts&&... xs) const noexcept
0066 {
0067 return boost::hof::always_ref(*this)(xs...);
0068 }
0069
0070 struct rotate_failure
0071 {
0072 template<class Failure>
0073 struct apply
0074 {
0075 template<class T, class... Ts>
0076 struct of
0077 : Failure::template of<Ts..., T>
0078 {};
0079 };
0080 };
0081
0082 struct failure
0083 : failure_map<rotate_failure, detail::callable_base<F>>
0084 {};
0085
0086 BOOST_HOF_RETURNS_CLASS(rotate_adaptor);
0087
0088 template<class T, class... Ts>
0089 constexpr BOOST_HOF_SFINAE_RESULT(const detail::callable_base<F>&, id_<Ts>..., id_<T>)
0090 operator()(T&& x, Ts&&... xs) const BOOST_HOF_SFINAE_RETURNS
0091 (
0092 (BOOST_HOF_MANGLE_CAST(const detail::callable_base<F>&)(BOOST_HOF_CONST_THIS->base_function(xs...)))
0093 (BOOST_HOF_FORWARD(Ts)(xs)..., BOOST_HOF_FORWARD(T)(x))
0094 );
0095 };
0096
0097 BOOST_HOF_DECLARE_STATIC_VAR(rotate, detail::make<rotate_adaptor>);
0098
0099 }}
0100
0101 #endif