/*<- Copyright Barrett Adair 2016-2017 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt) ->*/ #include #ifdef BOOST_CLBL_TRTS_DISABLE_VARIABLE_TEMPLATES int main(){ return 0; } #else //[ intro #include #include #include namespace ct = boost::callable_traits; // This function template helps keep our example code neat template void assert_same(){ static_assert(std::is_same::value, ""); } // foo is a function object struct foo { void operator()(int, char, float) const {} }; int main() { // Use args_t to retrieve a parameter list as a std::tuple: assert_same< ct::args_t, std::tuple >(); // has_void_return lets us perform a quick check for a void return type static_assert(ct::has_void_return::value, ""); // Detect C-style variadics (ellipses) in a signature (e.g. printf) static_assert(!ct::has_varargs::value, ""); // pmf is a pointer-to-member function: void (foo::*)(int, char, float) const using pmf = decltype(&foo::operator()); // remove_member_const_t lets you remove the const member qualifier assert_same< ct::remove_member_const_t, void (foo::*)(int, char, float) /*no const!*/ >(); // Conversely, add_member_const_t adds a const member qualifier assert_same< pmf, ct::add_member_const_t >(); // is_const_member_v checks for the presence of member const static_assert(ct::is_const_member::value, ""); } //] #endif