From 01957e9edb5c891c4ff780e7ea92c237de619bca Mon Sep 17 00:00:00 2001 From: Steven Schveighoffer Date: Sat, 25 Nov 2023 09:09:01 -0500 Subject: [PATCH 1/2] Fix 24267 - make it so grapheme can be used as an aa key --- std/uni/package.d | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/std/uni/package.d b/std/uni/package.d index 9903d6c28c3..fec7e5f78ac 100644 --- a/std/uni/package.d +++ b/std/uni/package.d @@ -7706,6 +7706,12 @@ public: return this.tupleof == other.tupleof; } + // Define a default toHash to allow AA usage + size_t toHash() const @trusted + { + return hashOf(slen_, hashOf(small_)); + } + /++ True if this object contains valid extended grapheme cluster. Decoding primitives of this module always return a valid `Grapheme`. @@ -7907,6 +7913,12 @@ static assert(Grapheme.sizeof == size_t.sizeof*4); assert(equal(h[], iota(cast(int)'A', cast(int)'Z'+1))); } +// ensure Grapheme can be used as an AA key. +@safe unittest +{ + int[Grapheme] aa; +} + /++ $(P Does basic case-insensitive comparison of `r1` and `r2`. This function uses simpler comparison rule thus achieving better performance From 1c52bd6096c73fd2ff4170cb1ef1a472e6bb2aa3 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sat, 2 Dec 2023 13:56:38 +0000 Subject: [PATCH 2/2] purge changelog --- changelog/PR8804.dd | 3 --- changelog/is_input_range_element.dd | 7 ------- changelog/unshared.dd | 13 ------------- 3 files changed, 23 deletions(-) delete mode 100644 changelog/PR8804.dd delete mode 100644 changelog/is_input_range_element.dd delete mode 100644 changelog/unshared.dd diff --git a/changelog/PR8804.dd b/changelog/PR8804.dd deleted file mode 100644 index 044c428c356..00000000000 --- a/changelog/PR8804.dd +++ /dev/null @@ -1,3 +0,0 @@ -Undo etc.c.odbc deprecation and enable usage on non-Windows systems - -Previously, the etc.c.odbc bindings were deprecated and forwarded the core.sys.windows versions of the bindings via public import. However, ODBC is supported on all major platforms and the machine translated MinGW bindings in core.sys.windows have version(Windows) specified which results in being unable to use those bindings on non-Windows platforms. The bindings have been returned to etc.c.odbc, undeprecated, and support for non-Windows platforms enabled. diff --git a/changelog/is_input_range_element.dd b/changelog/is_input_range_element.dd deleted file mode 100644 index 270bc8c485f..00000000000 --- a/changelog/is_input_range_element.dd +++ /dev/null @@ -1,7 +0,0 @@ -isInputRange now takes an optional element type. - -isInputRange now has an optional 2nd template parameter that defaults -to void. If not void, it only evaluates to true if the range's element -type is the same type as this extra argument, modulo const. For -instance, `isInputRange!(int[], const(int))` is true, but -`isInputRange!(int[], string)` is false. \ No newline at end of file diff --git a/changelog/unshared.dd b/changelog/unshared.dd deleted file mode 100644 index 66b096ec3be..00000000000 --- a/changelog/unshared.dd +++ /dev/null @@ -1,13 +0,0 @@ -Add Unshared to std.traits. - -`Unshared` is the `shared` equivalent of `Unconst`. It strips off the outer -layer of `shared` from a type. e.g. - -``` - static assert(Unshared!(shared int) == int); - static assert(Unshared!(shared(int[])) == shared(int)[]); -``` - -So, `Unconst` strips off the outer layer of `const`, `immutable`, and `inout`; -`Unshared` strips off the outer layer of `shared`; and `Unqual` strips off all -qualifiers from the outer layer of a type.