From: Kefu Chai Date: Mon, 26 Nov 2018 17:47:07 +0000 (+0800) Subject: buffer: fix the traits of list::iterator X-Git-Tag: v14.1.0~772^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1c5834be574c6bb2f9d0b44f41e50f0be050984a;p=ceph.git 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 --- diff --git a/src/include/buffer.h b/src/include/buffer.h index 368dc7fbd56d..a984cea4946e 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