Alchemy  1.0
A framework to robustly process network messages and structured data
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
size_at.h
1 /// @file meta/size_at.h
2 ///
3 /// Calculates the size in bytes of the type at the specified index in the Type Container.
4 ///
5 /// This construct depends on the SizeOf meta processing construct.
6 ///
7 /// The MIT License(MIT)
8 /// @copyright 2014 Paul M Watt
9 // ****************************************************************************
10 #ifndef SIZE_AT_H_INCLUDED
11 #define SIZE_AT_H_INCLUDED
12 // Includes *******************************************************************
13 #include <Pb/type_at.h>
14 #include <Pb/size_of.h>
15 
16 namespace Hg
17 {
18 
19 // ****************************************************************************
20 /// Calculate the size in bytes for the specified type.
21 ///
22 // Forward Declaration of Template *********************************************
23 template <size_t index,
24  typename ContainerT>
25 struct SizeAt;
26 
27 // The generic form of this template returns the result of sizeof. ************
28 template <size_t Index,
29  typename TypeT>
30 struct SizeAt
31  : std::integral_constant<size_t, sizeof(TypeT)>
32 { };
33 
34 } // namespace Hg
35 
36 // Include Type Container specific implementations.
37 #include <Pb/type_list/size_at.h>
38 
39 #endif