1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_FUNCTIONAL_IDENTITY_HPP
12 #define BOOST_COMPUTE_FUNCTIONAL_IDENTITY_HPP
18 template<class T, class Arg>
19 struct invoked_identity
21 typedef T result_type;
23 invoked_identity(const Arg &arg)
31 } // end detail namespace
33 /// Identity function which simply returns its input.
35 /// For example, to directly copy values using the transform() algorithm:
37 /// transform(input.begin(), input.end(), output.begin(), identity<int>(), queue);
40 /// \see \ref as "as<T>", \ref convert "convert<T>"
45 /// Identity function result type.
46 typedef T result_type;
48 /// Creates a new identity function.
55 detail::invoked_identity<T, Arg> operator()(const Arg &arg) const
57 return detail::invoked_identity<T, Arg>(arg);
61 } // end compute namespace
62 } // end boost namespace
64 #endif // BOOST_COMPUTE_FUNCTIONAL_IDENTITY_HPP