mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
make zstring family don't require empty angle brackets any more (#998)
Co-authored-by: Werner Henze <werner.henze+gitcommits@posteo.de>
This commit is contained in:
parent
f09b24970d
commit
da80ce15d8
16
README.md
16
README.md
@ -30,14 +30,14 @@ not_null | ☑ | restricts a pointer / smart po
|
|||||||
span | ☑ | a view over a contiguous sequence of memory. Based on the standardized verison of `std::span`, however `gsl::span` enforces bounds checking. See the [wiki](https://github.com/microsoft/GSL/wiki/gsl::span-and-std::span) for additional information.
|
span | ☑ | a view over a contiguous sequence of memory. Based on the standardized verison of `std::span`, however `gsl::span` enforces bounds checking. See the [wiki](https://github.com/microsoft/GSL/wiki/gsl::span-and-std::span) for additional information.
|
||||||
span_p | ☐ | spans a range starting from a pointer to the first place for which the predicate is true
|
span_p | ☐ | spans a range starting from a pointer to the first place for which the predicate is true
|
||||||
basic_zstring | ☑ | A pointer to a C-string (zero-terminated array) with a templated char type
|
basic_zstring | ☑ | A pointer to a C-string (zero-terminated array) with a templated char type
|
||||||
zstring | ☑ | An alias to `basic_zstring` with a char type of char
|
zstring | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of char
|
||||||
czstring | ☑ | An alias to `basic_zstring` with a char type of const char
|
czstring | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of const char
|
||||||
wzstring | ☑ | An alias to `basic_zstring` with a char type of wchar_t
|
wzstring | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of wchar_t
|
||||||
cwzstring | ☑ | An alias to `basic_zstring` with a char type of const wchar_t
|
cwzstring | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of const wchar_t
|
||||||
u16zstring | ☑ | An alias to `basic_zstring` with a char type of char16_t
|
u16zstring | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of char16_t
|
||||||
cu16zstring | ☑ | An alias to `basic_zstring` with a char type of const char16_t
|
cu16zstring | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of const char16_t
|
||||||
u32zstring | ☑ | An alias to `basic_zstring` with a char type of char32_t
|
u32zstring | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of char32_t
|
||||||
cu32zstring | ☑ | An alias to `basic_zstring` with a char type of const char32_t
|
cu32zstring | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of const char32_t
|
||||||
[**2. Owners**][cg-owners] | |
|
[**2. Owners**][cg-owners] | |
|
||||||
unique_ptr | ☑ | an alias to `std::unique_ptr`
|
unique_ptr | ☑ | an alias to `std::unique_ptr`
|
||||||
shared_ptr | ☑ | an alias to `std::shared_ptr`
|
shared_ptr | ☑ | an alias to `std::shared_ptr`
|
||||||
|
@ -59,29 +59,21 @@ namespace gsl
|
|||||||
template <typename CharT, std::size_t Extent = dynamic_extent>
|
template <typename CharT, std::size_t Extent = dynamic_extent>
|
||||||
using basic_zstring = CharT*;
|
using basic_zstring = CharT*;
|
||||||
|
|
||||||
template <std::size_t Extent = dynamic_extent>
|
using czstring = basic_zstring<const char, dynamic_extent>;
|
||||||
using czstring = basic_zstring<const char, Extent>;
|
|
||||||
|
|
||||||
template <std::size_t Extent = dynamic_extent>
|
using cwzstring = basic_zstring<const wchar_t, dynamic_extent>;
|
||||||
using cwzstring = basic_zstring<const wchar_t, Extent>;
|
|
||||||
|
|
||||||
template <std::size_t Extent = dynamic_extent>
|
using cu16zstring = basic_zstring<const char16_t, dynamic_extent>;
|
||||||
using cu16zstring = basic_zstring<const char16_t, Extent>;
|
|
||||||
|
|
||||||
template <std::size_t Extent = dynamic_extent>
|
using cu32zstring = basic_zstring<const char32_t, dynamic_extent>;
|
||||||
using cu32zstring = basic_zstring<const char32_t, Extent>;
|
|
||||||
|
|
||||||
template <std::size_t Extent = dynamic_extent>
|
using zstring = basic_zstring<char, dynamic_extent>;
|
||||||
using zstring = basic_zstring<char, Extent>;
|
|
||||||
|
|
||||||
template <std::size_t Extent = dynamic_extent>
|
using wzstring = basic_zstring<wchar_t, dynamic_extent>;
|
||||||
using wzstring = basic_zstring<wchar_t, Extent>;
|
|
||||||
|
|
||||||
template <std::size_t Extent = dynamic_extent>
|
using u16zstring = basic_zstring<char16_t, dynamic_extent>;
|
||||||
using u16zstring = basic_zstring<char16_t, Extent>;
|
|
||||||
|
|
||||||
template <std::size_t Extent = dynamic_extent>
|
using u32zstring = basic_zstring<char32_t, dynamic_extent>;
|
||||||
using u32zstring = basic_zstring<char32_t, Extent>;
|
|
||||||
|
|
||||||
namespace details
|
namespace details
|
||||||
{
|
{
|
||||||
|
@ -985,7 +985,7 @@ TEST(string_span_tests, zstring)
|
|||||||
auto name = CreateTempName({buf, 10});
|
auto name = CreateTempName({buf, 10});
|
||||||
if (!name.empty())
|
if (!name.empty())
|
||||||
{
|
{
|
||||||
czstring<> str = name.assume_z();
|
czstring str = name.assume_z();
|
||||||
EXPECT_TRUE(generic::strlen(str) == 3);
|
EXPECT_TRUE(generic::strlen(str) == 3);
|
||||||
EXPECT_TRUE(*(str + 3) == '\0');
|
EXPECT_TRUE(*(str + 3) == '\0');
|
||||||
}
|
}
|
||||||
@ -1028,7 +1028,7 @@ TEST(string_span_tests, wzstring)
|
|||||||
const auto name = CreateTempNameW({buf, 10});
|
const auto name = CreateTempNameW({buf, 10});
|
||||||
if (!name.empty())
|
if (!name.empty())
|
||||||
{
|
{
|
||||||
cwzstring<> str = name.assume_z();
|
cwzstring str = name.assume_z();
|
||||||
EXPECT_TRUE(generic::strnlen(str, 10) == 3);
|
EXPECT_TRUE(generic::strnlen(str, 10) == 3);
|
||||||
EXPECT_TRUE(*(str + 3) == L'\0');
|
EXPECT_TRUE(*(str + 3) == L'\0');
|
||||||
}
|
}
|
||||||
@ -1071,7 +1071,7 @@ TEST(string_span_tests, u16zstring)
|
|||||||
const auto name = CreateTempNameU16({buf, 10});
|
const auto name = CreateTempNameU16({buf, 10});
|
||||||
if (!name.empty())
|
if (!name.empty())
|
||||||
{
|
{
|
||||||
cu16zstring<> str = name.assume_z();
|
cu16zstring str = name.assume_z();
|
||||||
EXPECT_TRUE(generic::strnlen(str, 10) == 3);
|
EXPECT_TRUE(generic::strnlen(str, 10) == 3);
|
||||||
EXPECT_TRUE(*(str + 3) == L'\0');
|
EXPECT_TRUE(*(str + 3) == L'\0');
|
||||||
}
|
}
|
||||||
@ -1114,7 +1114,7 @@ TEST(string_span_tests, u32zstring)
|
|||||||
const auto name = CreateTempNameU32({buf, 10});
|
const auto name = CreateTempNameU32({buf, 10});
|
||||||
if (!name.empty())
|
if (!name.empty())
|
||||||
{
|
{
|
||||||
cu32zstring<> str = name.assume_z();
|
cu32zstring str = name.assume_z();
|
||||||
EXPECT_TRUE(generic::strnlen(str, 10) == 3);
|
EXPECT_TRUE(generic::strnlen(str, 10) == 3);
|
||||||
EXPECT_TRUE(*(str + 3) == L'\0');
|
EXPECT_TRUE(*(str + 3) == L'\0');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user