mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 12:44:42 +03:00
Added s suffix to string literal
As written, the type for "Hamlet" without the `s` suffix will be deduced to `const char*` instead of the intended `std::string`, see example earlier for auto deduced `std::string` for "Ophelia"s with the `s` suffix.
This commit is contained in:
committed by
GitHub
parent
1ddd9cdb7a
commit
d01675876f
@@ -14134,7 +14134,7 @@ Note that C++17 will make this rule redundant by allowing the template arguments
|
|||||||
[Template parameter deduction for constructors (Rev. 3)](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0091r1.html).
|
[Template parameter deduction for constructors (Rev. 3)](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0091r1.html).
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
tuple t1 = {1, "Hamlet", 3.14}; // deduced: tuple<int, string, double>
|
tuple t1 = {1, "Hamlet"s, 3.14}; // deduced: tuple<int, string, double>
|
||||||
|
|
||||||
##### Enforcement
|
##### Enforcement
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user