Feature #3963
closedBackport operator""s
0%
Description
Backport std::literals::string_literals::operator""s
from C++14. The (const char*, size_t)
overload returning an std::string
should be sufficient for our purposes. See http://en.cppreference.com/w/cpp/string/basic_string/operator%22%22s for more details.
Our implementation should be added to util/backports.hpp
, inside namespace ndn
. The standard library implementation should be preferred whenever available; the __cpp_lib_string_udls
feature-testing macro should be used for detection at compile-time, as recommended by WG21's SD-6.
Updated by Davide Pesavento almost 8 years ago
- Related to Feature #3076: C++14 support added
Updated by Davide Pesavento almost 8 years ago
- Status changed from New to Feedback
- Assignee set to Davide Pesavento
This turns out to be unimplementable. The C++14 standard says (combination of §13.5.8/1 [over.literal] and §17.6.4.3.4 [usrlit.suffix]):
Literal suffix identifiers that do not start with an underscore are reserved for future standardization.
A declaration whose literal-operator-id uses such a literal suffix identifier is ill-formed; no diagnostic required.
So we cannot define an operator""s
We can define operator""_s
though, which could be used as follows:
throw SomeError("foo"_s + "bar");
which is still better than:
throw SomeError(std::string("foo") + "bar");
Updated by Davide Pesavento over 7 years ago
Any opinions? If there's no interest, this task can be rejected.
Updated by Davide Pesavento over 7 years ago
There doesn't seem to be interest in this. Please reject.
Updated by Davide Pesavento over 7 years ago
- Assignee deleted (
Davide Pesavento)
Updated by Davide Pesavento almost 7 years ago
- Status changed from Feedback to Abandoned