Alchemy  1.0
A framework to robustly process network messages and structured data
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
length.h
1 /// @file meta/length.h
2 ///
3 /// Defines a construct that reports the number of types in a **type_container**.
4 ///
5 /// The MIT License(MIT)
6 /// @copyright 2014 Paul M Watt
7 // ****************************************************************************
8 #ifndef LENGTH_H_INCLUDED
9 #define LENGTH_H_INCLUDED
10 #include <Pb/meta_fwd.h>
11 
12 namespace Hg
13 {
14 
15 
16 // ****************************************************************************
17 /// Count the number of elements in the specified type container.
18 ///
19 /// @note
20 /// If this version is being used, Length is being instantiated for an invalid
21 /// type. Also, this generic implementation intentionally does not supply
22 /// a value member to report length.
23 ///
24 template <typename ContainerT>
25 struct length
26  : std::integral_constant<size_t, 1>
27 { };
28 
29 // Specialization to handle the case of an MT container. *******************
30 template <>
31 struct length< MT >
32  : std::integral_constant<size_t, 1>
33 { };
34 
35 } // namespace Hg
36 
37 // Include Type Container specific implementations.
38 #include <Pb/type_list/length.h>
39 
40 #endif