Update P0959.md

from_string()
This commit is contained in:
Marius Bancila 2018-11-02 23:13:56 +02:00 committed by GitHub
parent 96510aaaca
commit 0c2f9b5094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,7 +178,7 @@ std::array<uuid::value_type, 16> arr{ {
} };
uuid id1{ std::span<uuid::value_type, 16>{arr} };
uuid id2{"47183823-2574-4bfd-b411-99ed177d3e43"};
uuid id2 = uuid::from_string("47183823-2574-4bfd-b411-99ed177d3e43");
assert(id1 == id2);
std::set<std::uuid> ids{
@ -324,7 +324,7 @@ assert(id1.variant() == uuid_variant::rfc);
```
Examples for genearting new UUIDs with the `uuid_name_generator` class:
```cpp
uuid_name_generator dgen(uuid{"415ccc2b-f5cf-4ec1-b544-45132a518cc8"});
uuid_name_generator dgen(uuid::from_string("415ccc2b-f5cf-4ec1-b544-45132a518cc8"));
auto id1 = dgen("john");
assert(!id1.is_nil());
assert(id1.size() == 16);