close
Namespaces
Variants

Talk:cpp/language/user literal

From cppreference.com

There is no `u16` prefix in the standard. 81.3.129.2 08:44, 17 April 2018 (PDT)uta

NULL, should it not be nullptr?

There is a statement showing a NULL instead of nullptr. Since C++11 we are expected to use nullptr and this is a C++11 feature. Wondering whether it would make sense to change it. Alexis Wilke 02:15, 20 August 2019 (PDT)

Here nULL means the literal n followed by suffix ULL, not the null pointer value. Maybe we can find a better way to present it.... --D41D8CD98F (talk) 02:25, 20 August 2019 (PDT)

Being able to have negative values would be nice.

Example:

   inline long double operator"" _dBV(long double x) noexcept
   {
       return std::pow(10.L, x / 20.L);
   }
   auto some_value = -6.0_dBV;  // it would be nice if that gave 0.5, instead of -2 !!

m:o)

Tikabass (talk) 03:45, 11 April 2021 (PDT)

C++ doesn't have a notion of negative literals, only the notion of applying unary - to a non-negative literal, user defined literals have no bearing on this --Ybab321 (talk) 09:00, 12 April 2021 (PDT)

Mikekaganski What is the compiler support status for C++20 string literal operator template?

User-defined literal operator templates for strings was added by P0732R2, "Class types in non-type template parameters" in the compiler support page. --Ybab321 (talk) 03:03, 31 May 2023 (PDT)