From 9184792fc3e07273e252afe91e12f5b11a9cb2cd Mon Sep 17 00:00:00 2001 From: Marius Bancila Date: Thu, 10 Sep 2020 00:23:25 +0300 Subject: [PATCH] update open discussion --- P0959.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/P0959.md b/P0959.md index 86b8d11..a1c0c42 100644 --- a/P0959.md +++ b/P0959.md @@ -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>( + "47183823-2574-4bfd-b411-99ed177d3e43"); // [1] + +std::string str{ "47183823-2574-4bfd-b411-99ed177d3e43" }; +auto id2 = uuid::from_string>(str); // [2] ``` #### Need more explanations about the choices of ordering and how the RFC works in that regard.