make_call.cpp 753 B

123456789101112131415161718192021222324252627
  1. // Copyright (C) 2009-2012 Lorenzo Caminiti
  2. // Distributed under the Boost Software License, Version 1.0
  3. // (see accompanying file LICENSE_1_0.txt or a copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Home at http://www.boost.org/libs/functional/overloaded_function
  6. #include "identity.hpp"
  7. #include <boost/functional/overloaded_function.hpp>
  8. #include <boost/core/lightweight_test.hpp>
  9. //[identity_make_checks
  10. template<typename F>
  11. void check(F identity) {
  12. BOOST_TEST(identity("abc") == "abc");
  13. BOOST_TEST(identity(123) == 123);
  14. BOOST_TEST(identity(1.23) == 1.23);
  15. }
  16. //]
  17. int main() {
  18. //[identity_make_call
  19. check(boost::make_overloaded_function(identity_s, identity_i, identity_d));
  20. //]
  21. return boost::report_errors();
  22. }