Feature #3963
closed
Added by Davide Pesavento almost 8 years ago.
Updated over 6 years ago.
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.
- 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");
Any opinions? If there's no interest, this task can be rejected.
- Priority changed from Normal to Low
There doesn't seem to be interest in this. Please reject.
- Assignee deleted (
Davide Pesavento)
- Status changed from Feedback to Abandoned
Also available in: Atom
PDF