Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame^] | 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 `ndnboost::function`. |
| 13 | //] |
| 14 | #include <boost/function.hpp> |
| 15 | #include <string> |
| 16 | |
| 17 | //[identity_decls |
| 18 | const std::string& identity_s(const std::string& x) // Function (as pointer). |
| 19 | { return x; } |
| 20 | |
| 21 | int identity_i_impl(int x) { return x; } |
| 22 | int (&identity_i)(int) = identity_i_impl; // Function reference. |
| 23 | |
| 24 | double identity_d_impl(double x) { return x; } |
| 25 | ndnboost::function<double (double)> identity_d = identity_d_impl; // Functor. |
| 26 | //] |
| 27 | |
| 28 | #endif // #include guard |
| 29 | |