Update P0959.md

fixed string examples
This commit is contained in:
Marius Bancila 2018-11-02 19:45:39 +02:00 committed by GitHub
parent 07c92656b5
commit e9dd04b7a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -159,7 +159,7 @@ Because the internal representation may not be a straightforward array of bytes
Member functions `variant()` and `version()` allow checking the variant type of the uuid and, respectively, the version type. These are defined by two strongly typed enums called `uuid_variant` and `uuid_version`.
```cpp
uuid id("47183823-2574-4bfd-b411-99ed177d3e43");
uuid id = uuid::from_string("47183823-2574-4bfd-b411-99ed177d3e43");
assert(id.version() == uuid_version::random_number_based);
assert(id.variant() == uuid_variant::rfc);
```
@ -183,7 +183,7 @@ assert(id1 == id2);
std::set<std::uuid> ids{
uuid{},
uuid("47183823-2574-4bfd-b411-99ed177d3e43")
uuid::from_string("47183823-2574-4bfd-b411-99ed177d3e43")
};
assert(ids.size() == 2);
@ -214,7 +214,7 @@ Both member and non-member `swap()` functions are available to perform the swapp
```cpp
uuid empty;
uuid id("47183823-2574-4bfd-b411-99ed177d3e43");
uuid id = uuid::from_string("47183823-2574-4bfd-b411-99ed177d3e43");
assert(empty.is_nil());
assert(!id.is_nil());
@ -248,7 +248,7 @@ The order of the bytes in the input string reflects directly into the internal r
Non-member functions `to_string()` and `to_wstring()` return a string with the UUID formatted to the canonical textual representation `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`, where `x` is a lower case hexadecimal digit.
```cpp
uuid id("47183823-2574-4bfd-b411-99ed177d3e43");
uuid id = uuid::from_string("47183823-2574-4bfd-b411-99ed177d3e43");
assert(to_string(id) == "47183823-2574-4bfd-b411-99ed177d3e43");
assert(to_wstring(id) == L"47183823-2574-4bfd-b411-99ed177d3e43");
```
@ -261,7 +261,7 @@ Non-member `operators ==` and `operator !=` are provided in order to test the eq
```cpp
uuid empty;
uuid id("47183823-2574-4bfd-b411-99ed177d3e43");
uuid id = uuid::from_string("47183823-2574-4bfd-b411-99ed177d3e43");
assert(empty == empty);
assert(id == id);
@ -275,7 +275,7 @@ A `std::hash<>` specialization for `uuid` is provided in order to enable the use
```cpp
std::unordered_set<uuid> ids{
uuid{},
uuid("47183823-2574-4bfd-b411-99ed177d3e43"),
uuid::from_string("47183823-2574-4bfd-b411-99ed177d3e43"),
};
assert(ids.size() == 2);