Skip to content
Snippets Groups Projects
Commit 124ae476 authored by Tanki Zhang's avatar Tanki Zhang Committed by Jesse Beder
Browse files

Update the iterator implementation for C++17 (#575)

Fix the compiler error which prevents deriving from std::iterator in C++17
parent f996468a
No related branches found
No related tags found
No related merge requests found
......@@ -8,19 +8,19 @@
#endif
#include "yaml-cpp/dll.h"
#include "yaml-cpp/node/detail/node_iterator.h"
#include "yaml-cpp/node/node.h"
#include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/node/detail/node_iterator.h"
#include <cstddef>
#include <iterator>
namespace YAML {
namespace detail {
struct iterator_value;
template <typename V>
class iterator_base : public std::iterator<std::forward_iterator_tag, V,
std::ptrdiff_t, V*, V> {
class iterator_base {
private:
template <typename>
......@@ -37,7 +37,11 @@ class iterator_base : public std::iterator<std::forward_iterator_tag, V,
};
public:
typedef typename iterator_base::value_type value_type;
using iterator_category = std::forward_iterator_tag;
using value_type = V;
using difference_type = std::ptrdiff_t;
using pointer = V*;
using reference = V;
public:
iterator_base() : m_iterator(), m_pMemory() {}
......@@ -86,7 +90,7 @@ class iterator_base : public std::iterator<std::forward_iterator_tag, V,
base_type m_iterator;
shared_memory_holder m_pMemory;
};
}
}
} // namespace detail
} // namespace YAML
#endif // VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment