aimstil  5.0.5
cat2type.h
Go to the documentation of this file.
1 #ifndef CAT2TYPE_H_
2 #define CAT2TYPE_H_
3 
4 // includes from BOOST
5 #include <boost/utility/enable_if.hpp>
6 
10 // Right now, only binary tests -- I dunno if it's wise to go further... :/
11 // Actually, maybe the only safe way to generalize to more tests is to use a combination
12 // of binary tests. And that can be used straight away, by using several labels as
13 // function parameters.
14 
15 namespace til
16 {
17  //---------------------------------------------------------------------------
18 
20  namespace label
21  {
23  template < template <typename> class TIS_A >
24  struct Passed
25  {};
26 
28  template < template <typename> class TIS_A >
29  struct Failed
30  {};
31  }
32 
33  //---------------------------------------------------------------------------
34 
35  template < template <typename> class TIS_A, typename T>
36  inline
37  typename boost::enable_if<TIS_A<T>, label::Passed<TIS_A> >::type
39  {
40  return label::Passed<TIS_A>();
41  }
42 
43  //---------------------------------------------------------------------------
44 
45  template < template <typename> class TIS_A, typename T>
46  inline
47  typename boost::disable_if<TIS_A<T>, label::Failed<TIS_A> >::type
49  {
50  return label::Failed<TIS_A>();
51  }
52 
53  //---------------------------------------------------------------------------
54 
55 } // namespace
56 
57 
58 #endif /*CAT2TYPE_H_*/
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
test_whether< TIS_A, T >::type cat2type()
Do an is_a test.
Definition: cat2type.h:55
A label corresponding to a positive answer of a specific is_a test.
Definition: cat2type.h:24
A label corresponding to a negative answer of a specific is_a test.
Definition: cat2type.h:29