Support Class Library
A set of tools providing classes and utility
can_call.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <type_traits>
5 
6 namespace scl{
7  namespace tools{
8  namespace meta{
9  namespace details{
10  template <class Func, class... Args>
11  inline constexpr auto __can_call_impl(Func f, bool)
12  -> decltype(f(std::declval<Args>()...), std::true_type{}){
13  return std::true_type{};
14  }
15 
16  template <class Func, class...>
17  inline constexpr std::false_type __can_call_impl(Func, ...){
18  return std::false_type{};
19  }
20  }
21 
29  template <class Func, class... Args>
30  inline constexpr bool can_call(Func f){
31  return is_same<
32  decltype(details::__can_call_impl<Func, Args...>(f, true)),
33  std::true_type
34  >();
35  }
36  }
37  }
38 }
Global namespace of the SCL.
Definition: alias.hpp:3
constexpr bool can_call(Func f)
Determines whether or not the given function can be called with the given argument types...
Definition: can_call.h:30
constexpr bool is_same()
An handy function for the result of std::is_same.
Definition: is_same.h:12
constexpr auto __can_call_impl(Func f, bool) -> decltype(f(std::declval< Args >()...), std::true_type
Definition: can_call.h:11