Phi
yes_no_type.hpp
1 #ifndef INCG_PHI_CORE_TYPE_TRAITS_DETAIL_YES_NO_TYPE_HPP
2 #define INCG_PHI_CORE_TYPE_TRAITS_DETAIL_YES_NO_TYPE_HPP
3 
4 #include "phi/phi_config.hpp"
5 
6 #if PHI_HAS_EXTENSION_PRAGMA_ONCE()
7 # pragma once
8 #endif
9 
10 #include "phi/compiler_support/constexpr.hpp"
11 #include "phi/compiler_support/inline_variables.hpp"
12 #include "phi/compiler_support/warning.hpp"
13 #include "phi/core/size_t.hpp"
14 
15 DETAIL_PHI_BEGIN_NAMESPACE()
16 
17 PHI_GCC_SUPPRESS_WARNING_PUSH()
18 PHI_GCC_SUPPRESS_WARNING("-Wunused-const-variable")
19 
20 namespace detail
21 {
22  // size == 1
23  struct yes_type
24  {
25  char padding;
26  };
27 
28  PHI_INLINE_VARIABLE PHI_CONSTEXPR_AND_CONST static phi::size_t sizeof_yes_type =
29  sizeof(yes_type);
30 
31  // size == 8
32  struct no_type
33  {
34  char padding[8];
35  };
36 
37  PHI_INLINE_VARIABLE PHI_CONSTEXPR_AND_CONST static phi::size_t sizeof_no_type = sizeof(no_type);
38 } // namespace detail
39 
40 PHI_GCC_SUPPRESS_WARNING_POP()
41 
42 DETAIL_PHI_END_NAMESPACE()
43 
44 #endif // INCG_PHI_CORE_TYPE_TRAITS_DETAIL_YES_NO_TYPE_HPP
Definition: yes_no_type.hpp:32
Definition: swap.hpp:23
Definition: yes_no_type.hpp:23