update open discussion

This commit is contained in:
Marius Bancila 2020-09-10 00:23:25 +03:00 committed by GitHub
parent 6452aadcbe
commit 9184792fc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -825,9 +825,21 @@ auto id1 = uuid::from_string("47183823-2574-4bfd-b411-99ed177d3e43"); // [1]
std::string str{ "47183823-2574-4bfd-b411-99ed177d3e43" };
auto id2 = uuid::from_string(str); // [2]
```
Because there is no implicit conversion from `std::basic_string` to `std::basic_string_view`, [2] would not work. Instead, it should be:
Because template argument deduction does not work, both [1] and [2] would produce compiler errors. Instead, it should be one of the following, neither being desirable.
```cpp
auto id2 = uuid::from_string(std::string_view {str});
auto id1 = uuid::from_string(
std::string_view {"47183823-2574-4bfd-b411-99ed177d3e43"}); // [1]
std::string str{ "47183823-2574-4bfd-b411-99ed177d3e43" };
auto id2 = uuid::from_string(std::string_view {str}); // [2]
```
or
```cpp
auto id1 = uuid::from_string<char, std::char_traits<char>>(
"47183823-2574-4bfd-b411-99ed177d3e43"); // [1]
std::string str{ "47183823-2574-4bfd-b411-99ed177d3e43" };
auto id2 = uuid::from_string<char, std::char_traits<char>>(str); // [2]
```
#### Need more explanations about the choices of ordering and how the RFC works in that regard.