function_binding.cpp 769 B

12345678910111213141516171819202122
  1. // Copyright (C) 2006 Arkadiy Vertleyb
  2. // Use, modification and distribution is subject to the Boost Software
  3. // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
  4. #include <boost/typeof/typeof.hpp>
  5. #include <boost/type_traits/is_same.hpp>
  6. #include <boost/type_traits/is_same.hpp>
  7. #include <boost/static_assert.hpp>
  8. int foo1(double);
  9. int foo2(...);
  10. int foo3(int, ...);
  11. typedef int(&FREF1)(double);
  12. typedef int(&FREF2)(...);
  13. typedef int(&FREF3)(int, ...);
  14. FREF1 fref1 = *foo1;
  15. FREF2 fref2 = *foo2;
  16. FREF3 fref3 = *foo3;
  17. BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref1), int(double)>::value));
  18. BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref2), int(...)>::value));
  19. BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref3), int(int,...)>::value));