1 /////////////////////////////////////////////////////////////////////////////// 2 /// \file end.hpp 3 /// Proto callables for boost::end() 4 // 5 // Copyright 2012 Eric Niebler. Distributed under the Boost 6 // Software License, Version 1.0. (See accompanying file 7 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 9 #ifndef BOOST_PROTO_FUNCTIONAL_RANGE_END_HPP_EAN_27_08_2012 10 #define BOOST_PROTO_FUNCTIONAL_RANGE_END_HPP_EAN_27_08_2012 11 12 #include <boost/range/end.hpp> 13 #include <boost/proto/proto_fwd.hpp> 14 15 namespace boost { namespace proto { namespace functional 16 { 17 18 // A PolymorphicFunctionObject that wraps boost::end() 19 struct end 20 { 21 BOOST_PROTO_CALLABLE() 22 23 template<typename Sig> 24 struct result; 25 26 template<typename This, typename Rng> 27 struct result<This(Rng)> 28 : boost::range_iterator<Rng const> 29 {}; 30 31 template<typename This, typename Rng> 32 struct result<This(Rng &)> 33 : boost::range_iterator<Rng> 34 {}; 35 36 template<typename Rng> operator ()boost::proto::functional::end37 typename boost::range_iterator<Rng>::type operator()(Rng &rng) const 38 { 39 return boost::end(rng); 40 } 41 42 template<typename Rng> operator ()boost::proto::functional::end43 typename boost::range_iterator<Rng const>::type operator()(Rng const &rng) const 44 { 45 return boost::end(rng); 46 } 47 }; 48 49 }}} 50 51 #endif 52