From: Bruno Haible Date: Sun, 2 Aug 2020 18:19:31 +0000 (+0200) Subject: oset-c++, omap-c++: Remove restriction for search_atleast method. X-Git-Tag: v1.0~3831 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=7709284be61aaf9be6394221df5dd0179b871d15;p=gnulib.git oset-c++, omap-c++: Remove restriction for search_atleast method. * lib/gl_oset.hh (gl_OSet::search_atleast): Allow the threshold to be of a different type than the element. * lib/gl_omap.hh (gl_OMap::search_atleast): Allow the threshold to be of a different type than the key. --- diff --git a/ChangeLog b/ChangeLog index 544563af28..10d5227bfc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2020-08-02 Bruno Haible + + oset-c++, omap-c++: Remove restriction for search_atleast method. + * lib/gl_oset.hh (gl_OSet::search_atleast): Allow the threshold to be of + a different type than the element. + * lib/gl_omap.hh (gl_OMap::search_atleast): Allow the threshold to be of + a different type than the key. + 2020-08-01 Paul Eggert gnumakefile: say ‘$(MAKE)’ not ‘make’ diff --git a/lib/gl_omap.hh b/lib/gl_omap.hh index 1f892e46f8..903befb55d 100644 --- a/lib/gl_omap.hh +++ b/lib/gl_omap.hh @@ -89,8 +89,9 @@ public: THRESHOLD is defined by the THRESHOLD_FN. Returns true and stores the found pair in KEY and VALUE if found. Otherwise returns false. */ - bool search_atleast (bool (*threshold_fn) (KEYTYPE * /*key*/, KEYTYPE * /*threshold*/), - KEYTYPE * threshold, + template + bool search_atleast (bool (*threshold_fn) (KEYTYPE * /*key*/, THT * /*threshold*/), + THT * threshold, KEYTYPE *& key, VALUETYPE *& value) const { return gl_omap_search_atleast (_ptr, reinterpret_cast(threshold_fn), threshold, &key, &value); } diff --git a/lib/gl_oset.hh b/lib/gl_oset.hh index 5a72476229..157b8b995b 100644 --- a/lib/gl_oset.hh +++ b/lib/gl_oset.hh @@ -80,8 +80,9 @@ public: by the THRESHOLD_FN. Returns true and store the found element in ELT if found, otherwise returns false. */ - bool search_atleast (bool (*threshold_fn) (ELTYPE * /*elt*/, ELTYPE * /*threshold*/), - ELTYPE * threshold, + template + bool search_atleast (bool (*threshold_fn) (ELTYPE * /*elt*/, THT * /*threshold*/), + THT * threshold, ELTYPE *& elt) const { return gl_oset_search_atleast (_ptr, reinterpret_cast(threshold_fn), threshold, &elt); }