From 1c5834be574c6bb2f9d0b44f41e50f0be050984a Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 27 Nov 2018 01:47:07 +0800 Subject: [PATCH] buffer: fix the traits of list::iterator before this change, the constness of value, pointer, etc traits of list::iterator was wrong. also, because std::iterator is deprecated in C++17, we need to define the traits manually. so, do this change. these traits could be potentially used anywhere in the source tree. but a noteworthy user is is_const_iterator<> in denc.h. Signed-off-by: Kefu Chai --- src/include/buffer.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/include/buffer.h b/src/include/buffer.h index 368dc7fbd56..a984cea4946 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -395,8 +395,7 @@ namespace buffer CEPH_BUFFER_API { private: template - class CEPH_BUFFER_API iterator_impl - : public std::iterator { + class CEPH_BUFFER_API iterator_impl { protected: typedef typename std::conditional::const_iterator, typename std::list::iterator>::type list_iter_t; + using iterator_category = std::forward_iterator_tag; + using value_type = typename std::conditional::type; + using difference_type = std::ptrdiff_t; + using pointer = typename std::add_pointer::type; + using reference = typename std::add_lvalue_reference::type; + bl_t* bl; list_t* ls; // meh.. just here to avoid an extra pointer dereference.. unsigned off; // in bl -- 2.47.3