FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
meta_util.h
1 /**********************************************************\
2 Original Author: Georg Fritzsche
3 
4 Created: December 22, 2009
5 License: Dual license model; choose one of two:
6  New BSD License
7  http://www.opensource.org/licenses/bsd-license.php
8  - or -
9  GNU Lesser General Public License, version 2.1
10  http://www.gnu.org/licenses/lgpl-2.1.html
11 
12 Copyright 2009 Georg Fritzsche, Firebreath development team
13 \**********************************************************/
14 
15 #pragma once
16 #ifndef H_META_UTIL_22122009
17 #define H_META_UTIL_22122009
18 
19 #include <boost/optional.hpp>
20 #include "meta_util_impl.h"
21 
22 namespace FB { namespace meta
23 {
24  // get the plain type of T (without pointers, references, ...)
25  template<typename T>
26  struct plain_type
27  : FB::meta::detail::plain_type<T> {};
28 
30  // is optional - a boost::optional<T> type
31 
32  template <typename T>
33  struct is_optional
34  : boost::mpl::false_ {};
35 
36  template <typename T>
37  struct is_optional< boost::optional<T> >
38  : boost::mpl::true_ {};
39 
41  // is_boost_variant - is a boost::variant type
42 
43  template <typename T>
44  struct is_boost_variant
45  : boost::mpl::false_ {};
46 
47  template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
48  struct is_boost_variant< boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
49  : boost::mpl::true_ {};
50 
52  // STL style container classification
53  // T - the type to compare
54 
55  template<class T>
56  struct is_container
57  : FB::meta::detail::is_container<T> {};
58 
59  template<class T>
60  struct is_assoc_container
61  : FB::meta::detail::is_assoc_container<T> {};
62 
63  template<class T>
64  struct is_pair_assoc_container
65  : FB::meta::detail::is_pair_assoc_container<T> {};
66 
67  template<class T>
68  struct is_non_assoc_container
69  : FB::meta::detail::is_non_assoc_container<T> {};
70 
71  template<class T>
72  struct is_pseudo_container
73  : FB::meta::detail::is_pseudo_container<T> {};
74 
76  // enable_if helpers:
77  // T - the type to compare
78  // R - the return type
79 
80  template<class T, typename R=void>
81  struct enable_for_containers_and_numbers
82  : FB::meta::detail::enable_for_containers_and_numbers_impl<T,R> {};
83 
84  template<class T, typename R=void>
85  struct disable_for_containers_and_numbers
86  : FB::meta::detail::disable_for_containers_and_numbers_impl<T,R> {};
87 
88  template<class T, typename R=void>
89  struct enable_for_numbers
90  : FB::meta::detail::enable_for_numbers_impl<T,R> {};
91 
92  template<class T, typename R=void>
93  struct disable_for_numbers
94  : FB::meta::detail::disable_for_numbers_impl<T,R> {};
95 
96  template<class T, typename R=void>
97  struct enable_for_containers
98  : FB::meta::detail::enable_for_containers_impl<T,R> {};
99 
100  template<class T, typename R=void>
101  struct disable_for_containers
102  : FB::meta::detail::disable_for_containers_impl<T,R> {};
103 
104  template<class T, typename R=void>
105  struct enable_for_assoc_containers
106  : FB::meta::detail::enable_for_assoc_containers_impl<T,R> {};
107 
108  template<class T, typename R=void>
109  struct disable_for_assoc_containers
110  : FB::meta::detail::disable_for_assoc_containers_impl<T,R> {};
111 
112  template<class T, typename R=void>
113  struct enable_for_pair_assoc_containers
114  : FB::meta::detail::enable_for_pair_assoc_containers_impl<T,R> {};
115 
116  template<class T, typename R=void>
117  struct disable_for_pair_assoc_containers
118  : FB::meta::detail::disable_for_pair_assoc_containers_impl<T,R> {};
119 
120  template<class T, typename R=void>
121  struct enable_for_non_assoc_containers
122  : FB::meta::detail::enable_for_non_assoc_containers_impl<T,R> {};
123 
124  template<class T, typename R=void>
125  struct disable_for_non_assoc_containers
126  : FB::meta::detail::disable_for_non_assoc_containers_impl<T,R> {};
127 }; };
128 
129 
130 #endif
131