summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2021-01-12 11:14:39 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2021-01-12 16:00:24 +0100
commitf928b301026af0ce5739128382bc492768519615 (patch)
treef90ce9fd5ba18391b08f8461b9b22c09a1398da0
parent69dbe6302ab4597299bd640ddae4f10257414e26 (diff)
downloadglibmm-f928b301026af0ce5739128382bc492768519615.tar.gz
Deprecate Glib::BalancedTree in favour of std::map
or std::unordered_map. See issue #78
-rw-r--r--glib/src/balancedtree.hg4
-rw-r--r--tests/glibmm_btree/main.cc18
2 files changed, 21 insertions, 1 deletions
diff --git a/glib/src/balancedtree.hg b/glib/src/balancedtree.hg
index 9eb58fe6..9b8d6598 100644
--- a/glib/src/balancedtree.hg
+++ b/glib/src/balancedtree.hg
@@ -16,6 +16,8 @@
_DEFS(glibmm,glib)
+_IS_DEPRECATED // This whole file is deprecated.
+
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/error.h>
@@ -49,7 +51,7 @@ namespace Glib
* - less than operator
* - greater than operator
*
- * @note In most cases std::map or std::unordered_map is preferable.
+ * @deprecated Use std::map or std::unordered_map instead.
*
* @newin{2,24}
*/
diff --git a/tests/glibmm_btree/main.cc b/tests/glibmm_btree/main.cc
index dbe0f851..f2a1a478 100644
--- a/tests/glibmm_btree/main.cc
+++ b/tests/glibmm_btree/main.cc
@@ -1,5 +1,22 @@
+// Glib::BalancedTree is deprecated, but let's keep the test.
+// The recommended replacement is std::map or std::unordered_map
+// which requires no test here.
+#undef GLIBMM_DISABLE_DEPRECATED
+
#include <glibmm.h>
+#ifdef GLIBMM_DISABLE_DEPRECATED
+int
+main(int, char**)
+{
+ // If glibmm is configured with build-deprecated-api=false, GLIBMM_DISABLE_DEPRECATED
+ // is defined in glibmm.h (actually in glibmmconfig.h). The undef at the start of
+ // this file has no effect.
+ return 77; // Tell Meson's test harness to skip this test.
+}
+
+#else
+
using type_key_value = Glib::ustring;
using type_p_key_value = type_key_value*;
@@ -223,3 +240,4 @@ main()
return EXIT_SUCCESS;
}
+#endif // GLIBMM_DISABLE_DEPRECATED