Make safe_iterator inline friends

Jonathan Wakely jwakely@redhat.com
Fri Aug 31 22:13:00 GMT 2018


On 30/08/18 21:56 +0200, François Dumont wrote:
>--- a/libstdc++-v3/include/debug/safe_iterator.h
>+++ b/libstdc++-v3/include/debug/safe_iterator.h
>@@ -36,6 +36,28 @@
> #include <bits/stl_pair.h>
> #include <ext/type_traits.h>
> 
>+#define _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, _BadMsgId, _DiffMsgId) \
>+  _GLIBCXX_DEBUG_VERIFY(!_Lhs._M_singular() && !_Rhs._M_singular(),	\
>+			_M_message(_BadMsgId)				\
>+			._M_iterator(_Lhs, #_Lhs)			\
>+			._M_iterator(_Rhs, #_Rhs));			\
>+  _GLIBCXX_DEBUG_VERIFY(_Lhs._M_can_compare(_Rhs),			\
>+			_M_message(_DiffMsgId)				\
>+			._M_iterator(_Lhs, #_Lhs)			\
>+			._M_iterator(_Rhs, #_Rhs))
>+
>+#define _GLIBCXX_DEBUG_VERIFY_CMP_OPERANDS(_Lhs, _Rhs)			\
>+  _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, __msg_iter_compare_bad,	\
>+				 __msg_compare_different)
>+
>+#define _GLIBCXX_DEBUG_VERIFY_ORDER_OPERANDS(_Lhs, _Rhs)		\
>+  _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, __msg_iter_order_bad,	\
>+				 __msg_order_different)

Please use "EQ" instead of "CMP" and "REL" instead of "ORDER". Those
are the names used in the standard (the relational operators like less
than are still "comparisons" so only using CMP/compare for equality is
wrong).

OK for trunk with that change.



More information about the Gcc-patches mailing list