Project

General

Profile

Actions

Feature #3963

closed

Backport operator""s

Added by Davide Pesavento almost 8 years ago. Updated over 6 years ago.

Status:
Abandoned
Priority:
Low
Assignee:
-
Category:
Utils
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

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.


Related issues 1 (0 open1 closed)

Related to NFD - Feature #3076: C++14 supportClosedDavide Pesavento

Actions
Actions #1

Updated by Davide Pesavento almost 8 years ago

Actions #2

Updated by Davide Pesavento over 7 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");
Actions #3

Updated by Davide Pesavento over 7 years ago

Any opinions? If there's no interest, this task can be rejected.

Actions #4

Updated by Alex Afanasyev over 7 years ago

  • Priority changed from Normal to Low
Actions #5

Updated by Davide Pesavento over 7 years ago

There doesn't seem to be interest in this. Please reject.

Actions #6

Updated by Davide Pesavento over 7 years ago

  • Assignee deleted (Davide Pesavento)
Actions #7

Updated by Davide Pesavento over 6 years ago

  • Status changed from Feedback to Abandoned
Actions

Also available in: Atom PDF