NSVD Reader  0.0.1
vattr.hpp
Go to the documentation of this file.
1 
5 #ifndef __NODAMUSHI_SVD_VATTR_HPP__
6 #define __NODAMUSHI_SVD_VATTR_HPP__
7 
8 # include <tuple>
9 # include <type_traits>
10 # include <initializer_list>
11 
12 namespace nodamushi{
13 namespace svd{
14 
15 template<typename t,typename... types>struct contains
16 {
17  private:
18  static constexpr bool calc(){
19  using swallow = std::initializer_list<int>;
20  bool b = false;
21  (void)swallow{(void(b |= std::is_same<t,types>::value),0)...};
22  return b;
23  }
24  public:
25  static constexpr bool value = calc();
26 };
27 
28 
29 template<typename value,typename... attributes>struct vattr{};
30 
31 template<typename v>
33 {
34  using type = v;
35  using attr = std::tuple<>;
36  template<typename t>
37  using contains = ::std::false_type;
38 };
39 
40 template<typename v,typename... attributes>
41 struct vattr_unwrap<vattr<v,attributes...>>
42 {
43  using type = v;
44  using attribute = std::tuple<attributes...>;
45  template<typename t>
46  using contains = ::nodamushi::svd::contains<t,attributes...>;
47 };
48 
49 
50 } // end namespace svd
51 } // end namespace nodamushi
52 
53 // include attributes
55 
56 
57 #endif // __NODAMUSHI_SVD_VATTR_HPP__
hex attribute
This class reperesents SVD(xml) element / attribute.
Definition: value.hpp:53
::std::false_type contains
Definition: vattr.hpp:37