1 2 // (C) Copyright Tobias Schwinger 3 // 4 // Use modification and distribution are subject to the boost Software License, 5 // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). 6 7 //------------------------------------------------------------------------------ 8 9 #ifndef BOOST_FT_DETAIL_CLASSIFIER_HPP_INCLUDED 10 #define BOOST_FT_DETAIL_CLASSIFIER_HPP_INCLUDED 11 12 #include <boost/type.hpp> 13 #include <boost/config.hpp> 14 #include <boost/type_traits/is_reference.hpp> 15 #include <boost/type_traits/add_reference.hpp> 16 17 #include <boost/function_types/config/config.hpp> 18 #include <boost/function_types/property_tags.hpp> 19 20 namespace boost { namespace function_types { namespace detail { 21 22 template<typename T> struct classifier; 23 24 template<std::size_t S> struct char_array { typedef char (&type)[S]; }; 25 26 template<bits_t Flags, bits_t CCID, std::size_t Arity> struct encode_charr 27 { 28 typedef typename char_array< 29 ::boost::function_types::detail::encode_charr_impl<Flags,CCID,Arity>::value 30 >::type type; 31 }; 32 33 #if defined(BOOST_MSVC) || (defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)) 34 # define BOOST_FT_DECL __cdecl 35 #else 36 # define BOOST_FT_DECL /**/ 37 #endif 38 39 char BOOST_FT_DECL classifier_impl(...); 40 41 #define BOOST_FT_variations BOOST_FT_function|BOOST_FT_pointer|\ 42 BOOST_FT_member_pointer 43 44 #define BOOST_FT_type_function(cc,name) BOOST_FT_SYNTAX( \ 45 R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,* BOOST_PP_EMPTY,name,BOOST_PP_RPAREN) 46 47 #define BOOST_FT_type_function_pointer(cc,name) BOOST_FT_SYNTAX( \ 48 R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,** BOOST_PP_EMPTY,name,BOOST_PP_RPAREN) 49 50 #define BOOST_FT_type_member_function_pointer(cc,name) BOOST_FT_SYNTAX( \ 51 R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,T0::** BOOST_PP_EMPTY,name,BOOST_PP_RPAREN) 52 53 #define BOOST_FT_al_path boost/function_types/detail/classifier_impl 54 #include <boost/function_types/detail/pp_loop.hpp> 55 56 template<typename T> struct classifier_bits 57 { 58 static typename boost::add_reference<T>::type tester; 59 60 BOOST_STATIC_CONSTANT(bits_t,value = (bits_t)sizeof( 61 boost::function_types::detail::classifier_impl(& tester) 62 )-1); 63 }; 64 65 template<typename T> struct classifier 66 { 67 typedef detail::constant< 68 ::boost::function_types::detail::decode_bits< 69 ::boost::function_types::detail::classifier_bits<T>::value 70 >::tag_bits > 71 bits; 72 73 typedef detail::full_mask mask; 74 75 typedef detail::constant< 76 ::boost::function_types::detail::decode_bits< 77 ::boost::function_types::detail::classifier_bits<T>::value 78 >::arity > 79 function_arity; 80 }; 81 82 83 84 } } } // namespace ::boost::function_types::detail 85 86 #endif 87 88