#pragma once #ifndef NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 #define NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 namespace YAML { template struct is_same_type { enum { value = false }; }; template struct is_same_type { enum { value = true }; }; template struct is_index_type_with_check { enum { value = false }; }; template <> struct is_index_type_with_check { enum { value = true }; }; #define MAKE_INDEX_TYPE(Type) \ template <> struct is_index_type_with_check::value> { enum { value = true }; } MAKE_INDEX_TYPE(int); MAKE_INDEX_TYPE(unsigned); MAKE_INDEX_TYPE(short); MAKE_INDEX_TYPE(unsigned short); MAKE_INDEX_TYPE(long); MAKE_INDEX_TYPE(unsigned long); #undef MAKE_INDEX_TYPE template struct is_index_type: public is_index_type_with_check {}; // messing around with template stuff to get the right overload for operator [] for a sequence template struct _FindFromNodeAtIndex { const Node *pRet; _FindFromNodeAtIndex(const Node&, const T&): pRet(0) {} }; template struct _FindFromNodeAtIndex { const Node *pRet; _FindFromNodeAtIndex(const Node& node, const T& key): pRet(node.FindAtIndex(static_cast(key))) {} }; template inline const Node *FindFromNodeAtIndex(const Node& node, const T& key) { return _FindFromNodeAtIndex::value>(node, key).pRet; } } #endif // NODEUTIL_H_62B23520_7C8E_11DE_8A39_0800200C9A66