mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-17 10:04:35 +03:00
Remove non-std lib example.
This commit is contained in:
@@ -430,14 +430,6 @@ factorial(5); // == 120
|
|||||||
### User-defined literals for standard library types
|
### User-defined literals for standard library types
|
||||||
New user-defined literals for standard library types, including new built-in literals for `chrono` and `basic_string`. These can be `constexpr` meaning they can be used at compile-time. Some uses for these literals include compile-time integer parsing, binary literals, and imaginary number literals.
|
New user-defined literals for standard library types, including new built-in literals for `chrono` and `basic_string`. These can be `constexpr` meaning they can be used at compile-time. Some uses for these literals include compile-time integer parsing, binary literals, and imaginary number literals.
|
||||||
```c++
|
```c++
|
||||||
constexpr int operator"" _test(unsigned long long x) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
123_test; // == 0
|
|
||||||
```
|
|
||||||
|
|
||||||
Built in literals for `chrono`:
|
|
||||||
```c++
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
auto day = 24h;
|
auto day = 24h;
|
||||||
day.count(); // == 24
|
day.count(); // == 24
|
||||||
|
|||||||
Reference in New Issue
Block a user