From 163ea62554322fc22cfe6fec10faefdd06046cf7 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Wed, 10 May 2017 21:34:06 +0200 Subject: [PATCH] Add _it_equal_p operator for both dictionnary. --- m-dict.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/m-dict.h b/m-dict.h index d6f9d67c..e5d7d0e5 100644 --- a/m-dict.h +++ b/m-dict.h @@ -403,6 +403,14 @@ return M_C3(dict_, name, _end_p)(it2); \ } \ \ + static inline bool \ + M_C3(dict_, name, _it_equal_p)(const dict_it_t it1, const dict_it_t it2) \ + { \ + assert (it1 != NULL && it2 != NULL); \ + return M_C3(list_dict_pair_, name, _it_equal_p)(it1->list_it, \ + it2->list_it); \ + } \ + \ static inline M_C3(dict_pair_,name,_t) * \ M_C3(dict_, name, _ref)(dict_it_t it) \ { \ @@ -1102,6 +1110,15 @@ typedef enum { return M_C3(dict_, name, _end_p)(it2); \ } \ \ + static inline bool \ + M_C3(dict_, name, _it_equal_p)(const dict_it_t it1,const dict_it_t it2) \ + { \ + assert (it1 != NULL && it2 != NULL); \ + DICTI_OA_CONTRACT (it1->dict); \ + DICTI_OA_CONTRACT (it2->dict); \ + return it1->dict == it2->dict && it1->index == it2->index; \ + } \ + \ /* FIXME: Wrong level of indirection compared to std dict? */ \ static inline M_C3(dict_pair_,name,_t) * \ M_C3(dict_, name, _ref)(dict_it_t it) \