~ubuntu-branches/debian/sid/boost1.49/sid

« back to all changes in this revision

Viewing changes to boost/function_types/detail/classifier.hpp

  • Committer: Package Import Robot
  • Author(s): Steve M. Robbins
  • Date: 2012-02-26 00:31:44 UTC
  • Revision ID: package-import@ubuntu.com-20120226003144-eaytp12cbf6ubpms
Tags: upstream-1.49.0
ImportĀ upstreamĀ versionĀ 1.49.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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/config.hpp>
 
15
#include <boost/type_traits/is_reference.hpp>
 
16
#include <boost/type_traits/add_reference.hpp>
 
17
 
 
18
#include <boost/function_types/config/config.hpp>
 
19
#include <boost/function_types/property_tags.hpp>
 
20
 
 
21
namespace boost { namespace function_types { namespace detail {
 
22
 
 
23
template<typename T> struct classifier;
 
24
 
 
25
template<std::size_t S> struct char_array { typedef char (&type)[S]; };
 
26
 
 
27
template<bits_t Flags, bits_t CCID, std::size_t Arity> struct encode_charr
 
28
{
 
29
  typedef typename char_array<
 
30
    ::boost::function_types::detail::encode_charr_impl<Flags,CCID,Arity>::value 
 
31
  >::type type;
 
32
};
 
33
 
 
34
char BOOST_TT_DECL classifier_impl(...);
 
35
 
 
36
#define BOOST_FT_variations BOOST_FT_function|BOOST_FT_pointer|\
 
37
                            BOOST_FT_member_pointer
 
38
 
 
39
#define BOOST_FT_type_function(cc,name) BOOST_FT_SYNTAX( \
 
40
    R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,* BOOST_PP_EMPTY,name,BOOST_PP_RPAREN)
 
41
 
 
42
#define BOOST_FT_type_function_pointer(cc,name) BOOST_FT_SYNTAX( \
 
43
    R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,** BOOST_PP_EMPTY,name,BOOST_PP_RPAREN)
 
44
 
 
45
#define BOOST_FT_type_member_function_pointer(cc,name) BOOST_FT_SYNTAX( \
 
46
    R BOOST_PP_EMPTY,BOOST_PP_LPAREN,cc,T0::** BOOST_PP_EMPTY,name,BOOST_PP_RPAREN)
 
47
 
 
48
#define BOOST_FT_al_path boost/function_types/detail/classifier_impl
 
49
#include <boost/function_types/detail/pp_loop.hpp>
 
50
 
 
51
template<typename T> struct classifier_bits
 
52
{
 
53
  static typename boost::add_reference<T>::type tester;
 
54
 
 
55
  BOOST_STATIC_CONSTANT(bits_t,value = (bits_t)sizeof(
 
56
    boost::function_types::detail::classifier_impl(& tester) 
 
57
  )-1);
 
58
};
 
59
 
 
60
template<typename T> struct classifier
 
61
{
 
62
  typedef detail::constant<
 
63
    ::boost::function_types::detail::decode_bits<
 
64
      ::boost::function_types::detail::classifier_bits<T>::value
 
65
    >::tag_bits > 
 
66
  bits;
 
67
 
 
68
  typedef detail::full_mask mask;
 
69
 
 
70
  typedef detail::constant<
 
71
    ::boost::function_types::detail::decode_bits<
 
72
      ::boost::function_types::detail::classifier_bits<T>::value
 
73
    >::arity > 
 
74
  function_arity;
 
75
};
 
76
 
 
77
 
 
78
 
 
79
} } } // namespace ::boost::function_types::detail
 
80
 
 
81
#endif
 
82