Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: /// \file reverse.hpp Chris@16: /// Proto callables Fusion reverse Chris@16: // Chris@16: // Copyright 2010 Eric Niebler. Distributed under the Boost Chris@16: // Software License, Version 1.0. (See accompanying file Chris@16: // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_PROTO_FUNCTIONAL_FUSION_REVERSE_HPP_EAN_11_27_2010 Chris@16: #define BOOST_PROTO_FUNCTIONAL_FUSION_REVERSE_HPP_EAN_11_27_2010 Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace proto { namespace functional Chris@16: { Chris@16: /// \brief A PolymorphicFunctionObject type that invokes the Chris@16: /// \c fusion::reverse() algorithm on its argument. Chris@16: /// Chris@16: /// A PolymorphicFunctionObject type that invokes the Chris@16: /// \c fusion::reverse() algorithm on its argument. This is Chris@16: /// useful for defining a CallableTransform like \c reverse(_) Chris@16: /// which reverses the order of the children of a Proto Chris@16: /// expression node. Chris@16: struct reverse Chris@16: { Chris@16: BOOST_PROTO_CALLABLE() Chris@16: Chris@16: template Chris@16: struct result; Chris@16: Chris@16: template Chris@16: struct result Chris@16: : result Chris@16: {}; Chris@16: Chris@16: template Chris@16: struct result Chris@16: : fusion::result_of::reverse Chris@16: {}; Chris@16: Chris@16: template Chris@16: typename fusion::result_of::reverse::type Chris@16: operator ()(Seq &seq) const Chris@16: { Chris@16: // Work around a const-correctness issue in Fusion Chris@16: typedef typename fusion::result_of::reverse::type result_type; Chris@16: return result_type(seq); Chris@16: } Chris@16: Chris@16: template Chris@16: typename fusion::result_of::reverse::type Chris@16: operator ()(Seq const &seq) const Chris@16: { Chris@16: return fusion::reverse(seq); Chris@16: } Chris@16: }; Chris@16: }}} Chris@16: Chris@16: #endif