From d877b366298ab502690424fe0ed4f40c3346bce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sun, 21 Sep 2025 07:51:51 +0200 Subject: [PATCH] Make deque_iterator explicit instantiation friendly. --- include/boost/container/deque.hpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp index 943430b..5bfed07 100644 --- a/include/boost/container/deque.hpp +++ b/include/boost/container/deque.hpp @@ -135,24 +135,31 @@ class deque_iterator BOOST_CONSTEXPR inline static difference_type get_block_ssize() BOOST_NOEXCEPT_OR_NOTHROW { return difference_type((get_block_size())); } - class nat; - typedef typename dtl::if_c< IsConst - , deque_iterator - , nat>::type nonconst_iterator; - typedef Pointer val_alloc_ptr; typedef typename boost::intrusive::pointer_traits:: template rebind_pointer::type index_pointer; + class nat + { + public: + inline Pointer get_cur() const { return Pointer(); } + inline index_pointer get_node() const { return index_pointer(); } + }; + + typedef typename dtl::if_c< IsConst + , deque_iterator + , nat>::type nonconst_iterator_arg; + + Pointer m_cur; index_pointer m_node; public: BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline Pointer get_cur() const { return m_cur; } + BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline index_pointer get_node() const { return m_node; } BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline Pointer get_first() const { return *m_node; } BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline Pointer get_last() const { return *m_node + get_block_ssize(); } - BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline index_pointer get_node() const { return m_node; } inline deque_iterator(val_alloc_ptr x, index_pointer y) BOOST_NOEXCEPT_OR_NOTHROW : m_cur(x), m_node(y) @@ -166,16 +173,19 @@ class deque_iterator : m_cur(x.get_cur()), m_node(x.get_node()) {} - inline deque_iterator(const nonconst_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW + inline deque_iterator(const nonconst_iterator_arg& x) BOOST_NOEXCEPT_OR_NOTHROW : m_cur(x.get_cur()), m_node(x.get_node()) {} inline deque_iterator& operator=(const deque_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW { m_cur = x.get_cur(); m_node = x.get_node(); return *this; } - inline nonconst_iterator unconst() const BOOST_NOEXCEPT_OR_NOTHROW + inline deque_iterator& operator=(const nonconst_iterator_arg& x) BOOST_NOEXCEPT_OR_NOTHROW + { m_cur = x.get_cur(); m_node = x.get_node(); return *this; } + + inline deque_iterator unconst() const BOOST_NOEXCEPT_OR_NOTHROW { - return nonconst_iterator(this->get_cur(), this->get_node()); + return deque_iterator(this->get_cur(), this->get_node()); } inline reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW