nodeutil.h
Go to the documentation of this file.
1 #ifndef NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
2 #define NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
3 
4 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
5 #pragma once
6 #endif
7 
8 
9 namespace YAML_PM
10 {
11  template <typename T, typename U>
12  struct is_same_type {
13  enum { value = false };
14  };
15 
16  template <typename T>
17  struct is_same_type<T, T> {
18  enum { value = true };
19  };
20 
21  template <typename T, bool check>
23  enum { value = false };
24  };
25 
26  template <> struct is_index_type_with_check<std::size_t, false> { enum { value = true }; };
27 
28 #define MAKE_INDEX_TYPE(Type) \
29  template <> struct is_index_type_with_check<Type, is_same_type<Type, std::size_t>::value> { enum { value = true }; }
30 
31  MAKE_INDEX_TYPE(int);
32  MAKE_INDEX_TYPE(unsigned);
33  MAKE_INDEX_TYPE(short);
34  MAKE_INDEX_TYPE(unsigned short);
35  MAKE_INDEX_TYPE(long);
36  MAKE_INDEX_TYPE(unsigned long);
37 
38 #undef MAKE_INDEX_TYPE
39 
40  template <typename T>
41  struct is_index_type: public is_index_type_with_check<T, false> {};
42 
43  // messing around with template stuff to get the right overload for operator [] for a sequence
44  template <typename T, bool b>
46  const Node *pRet;
47  _FindFromNodeAtIndex(const Node&, const T&): pRet(0) {}
48  };
49 
50  template <typename T>
51  struct _FindFromNodeAtIndex<T, true> {
52  const Node *pRet;
53  _FindFromNodeAtIndex(const Node& node, const T& key): pRet(node.FindAtIndex(static_cast<std::size_t>(key))) {}
54  };
55 
56  template <typename T>
57  inline const Node *FindFromNodeAtIndex(const Node& node, const T& key) {
59  }
60 }
61 
62 #endif // NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66_PM
_FindFromNodeAtIndex(const Node &node, const T &key)
Definition: nodeutil.h:53
MAKE_INDEX_TYPE(int)
const Node * FindFromNodeAtIndex(const Node &node, const T &key)
Definition: nodeutil.h:57
_FindFromNodeAtIndex(const Node &, const T &)
Definition: nodeutil.h:47


libpointmatcher
Author(s):
autogenerated on Sat May 27 2023 02:38:02