Alchemy  1.0
A framework to robustly process network messages and structured data
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
conditional.h
Go to the documentation of this file.
1 /// @file Pb/detail/conditional.h
2 ///
3 /// Provides std::conditional for tr1 implementations that do not support it.
4 ///
5 /// The MIT License(MIT)
6 /// @copyright 2014 Paul M Watt
7 // ****************************************************************************
8 #ifndef PB_DETAIL_CONDITIONAL_H_INCLUDED
9 #define PB_DETAIL_CONDITIONAL_H_INCLUDED
10 
11 namespace Pb
12 {
13 
14 // ***************************************************************************
15 /// Provides an implementation of a compile-time conditional when the local
16 /// library does not support it.
17 ///
18 template< bool Predicate,
19  class TrueType,
20  class FalseType
21  >
23 {
24  typedef TrueType type;
25 };
26 
27 // ***************************************************************************
28 /// Specialization for the false condition of the conditional.
29 ///
30 template< class TrueType,
31  class FalseType
32  >
33 struct conditional<false, TrueType, FalseType>
34 {
35  typedef FalseType type;
36 };
37 
38 } // namespace Pb
39 
40 #endif