Skip to content

Commit

Permalink
Merge tag 'v5.1.5' into v5.2.x
Browse files Browse the repository at this point in the history
v5.1.5: Fix isUTF8StringType to work with static arrays

## Bug Fixes

### 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.

See #778
  • Loading branch information
Geod24 committed Dec 12, 2020
2 parents aeb8288 + f20c5bf commit 075fa5b
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!(Immut!(char)[]));
static assert (!isUTF8StringType!(wchar[]));
Expand Down

0 comments on commit 075fa5b

Please sign in to comment.