Skip to content

Commit

Permalink
Merge tag 'v5.3.1' into v5.4.x
Browse files Browse the repository at this point in the history
v5.3.1: Merge v5.1.5 bugfix for isUTF8StringType

This release is a merge of v5.1.4 .. v5.1.5 into v5.3.x.
  • Loading branch information
Geod24 committed Dec 12, 2020
2 parents f949707 + 2c5d959 commit 664a8ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions relnotes/fix-is-string-type.bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Fix function to check for UTF-8 string type

`ocean.meta.traits.Arrays`

The function `ocean.meta.traits.Arrays.isUTF8StringType()` is suggested to
replace the deprecated `ocean.core.Traits.isStringType()` but it failed to
check for static arrays and now it is fixed to support both basic kind of
arrays.

Fixes #778
4 changes: 2 additions & 2 deletions src/ocean/meta/traits/Arrays.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import ocean.meta.types.Qualifiers;
template isUTF8StringType ( T )
{
static immutable isUTF8StringType =
isArrayType!(T) == ArrayKind.Dynamic
&& is(Unqual!(ElementTypeOf!(T)) == char);
isBasicArrayType!(T) && is(Unqual!(ElementTypeOf!(T)) == char);
}

///
unittest
{
static assert (isUTF8StringType!(char[1]));
static assert (isUTF8StringType!(char[]));
static assert (isUTF8StringType!(immutable(char)[]));
static assert (!isUTF8StringType!(wchar[]));
Expand Down

0 comments on commit 664a8ca

Please sign in to comment.