is_invocable.cpp 569 B

123456789101112131415161718192021222324
  1. /*<-
  2. Copyright (c) 2016 Barrett Adair
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  5. ->*/
  6. //[ is_invocable
  7. #include <type_traits>
  8. #include <boost/callable_traits/is_invocable.hpp>
  9. namespace ct = boost::callable_traits;
  10. struct foo {
  11. template<typename T>
  12. typename std::enable_if<std::is_integral<T>::value>::type
  13. operator()(T){}
  14. };
  15. static_assert(ct::is_invocable<foo, int>::value, "");
  16. static_assert(!ct::is_invocable<foo, double>::value, "");
  17. int main() {}
  18. //]