// Copyright (c) 2009-2016 Vladimir Batov. // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. See http://www.boost.org/LICENSE_1_0.txt. #ifndef BOOST_CONVERT_IS_FUNCTION_HPP #define BOOST_CONVERT_IS_FUNCTION_HPP #include #include #include #include #include #include #include namespace boost { namespace cnv { typedef ::boost::type_traits::yes_type yes_type; typedef ::boost::type_traits:: no_type no_type; template struct check_functor { BOOST_STATIC_CONSTANT(bool, value = false); }; template struct is_fun { BOOST_STATIC_CONSTANT(bool, value = false); }; template struct check_functor { static yes_type test (TypeOut const&); static no_type test (...); static const bool value = sizeof(yes_type) == sizeof(test(((Functor*) 0)->operator()())); }; template struct is_fun::value && !is_convertible::value, void>::type> { BOOST_DECLARE_HAS_MEMBER(has_funop, operator()); BOOST_STATIC_CONSTANT(bool, value = (check_functor::value, Functor, TypeOut>::value)); }; template struct is_fun::value && function_types::function_arity::value == 0 && !is_same::value, void>::type> { typedef TypeOut out_type; typedef typename function_types::result_type::type func_out_type; BOOST_STATIC_CONSTANT(bool, value = (is_convertible::value)); }; }} #endif // BOOST_CONVERT_IS_FUNCTION_HPP