1 2 // Copyright (C) 2009-2012 Lorenzo Caminiti 3 // Distributed under the Boost Software License, Version 1.0 4 // (see accompanying file LICENSE_1_0.txt or a copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 // Home at http://www.boost.org/libs/functional/overloaded_function 7 8 #ifndef IDENTITY_HPP_ 9 #define IDENTITY_HPP_ 10 11 //[identity_typeof 12 #include <boost/typeof/std/string.hpp> // No need to register `boost::function`. 13 //] 14 #include <boost/function.hpp> 15 #include <string> 16 17 //[identity_decls identity_s(const std::string & x)18const std::string& identity_s(const std::string& x) // Function (as pointer). 19 { return x; } 20 identity_i_impl(int x)21int identity_i_impl(int x) { return x; } 22 int (&identity_i)(int) = identity_i_impl; // Function reference. 23 identity_d_impl(double x)24double identity_d_impl(double x) { return x; } 25 boost::function<double (double)> identity_d = identity_d_impl; // Functor. 26 //] 27 28 #endif // #include guard 29 30