libfly  6.2.2
C++20 utility library for Linux, macOS, and Windows
fly::literals Namespace Reference

Functions

template<char... Literals>
FLY_CONSTEVAL fly::logger::Color operator""_c ()
 
template<char... Literals>
FLY_CONSTEVAL std::int8_t operator""_i8 ()
 
template<char... Literals>
FLY_CONSTEVAL std::int16_t operator""_i16 ()
 
template<char... Literals>
FLY_CONSTEVAL std::int32_t operator""_i32 ()
 
template<char... Literals>
FLY_CONSTEVAL std::int64_t operator""_i64 ()
 
template<char... Literals>
FLY_CONSTEVAL std::uint8_t operator""_u8 ()
 
template<char... Literals>
FLY_CONSTEVAL std::uint16_t operator""_u16 ()
 
template<char... Literals>
FLY_CONSTEVAL std::uint32_t operator""_u32 ()
 
template<char... Literals>
FLY_CONSTEVAL std::uint64_t operator""_u64 ()
 
template<char... Literals>
FLY_CONSTEVAL std::size_t operator""_zu ()
 

Detailed Description

Type-safe, fixed-width integer literal suffixes not provided by the STL.

The expression that precedes the literal suffix is parsed and validated at compile time. Compilation will fail if any of the following error conditions are met:

1. The expression preceding the literal suffix is invalid. All standard integer literals are
   accepted.
2. The value represented by the preceding expression does not fit in the type specified by
   the suffix.
3. A character in the preceding expression does not match the corresponding base (e.g. 0b2 is
   an invalid expression).

The inline namespaces are to allow importing literal suffixes in the fly namespace with explicit control, without polluting the global namespace. Callers may import the literal suffixes in this file in any of the following ways:

// Import only the literal suffixes declared in this file. This is recommended.
using namespace fly::literals::numeric_literals;

// Import all literal suffixes declared in the fly namespace. Okay, but not recommended.
using namespace fly::literals;

// Import a specific literal suffix declared in this file. Okay, but can be verbose.
using fly::literals::numeric_literals::operator"" _i8;

// Import all symbols from namespace fly. Okay, but strongly discouraged.
using namespace fly;
Author
Timothy Flynn (trfly.nosp@m.nn89.nosp@m.@pm.m.nosp@m.e)
Version
December 15, 2019

Function Documentation

◆ operator""_c()

template<char... Literals>
FLY_CONSTEVAL fly::logger::Color fly::literals::styler_literals::operator""_c ( )
inline

Type-safe integer literal suffix to construct a Color as a foreground color. The integer literal must be in the range [0, 255].

Template Parameters
LiteralsThe numeric literals from which to construct a 256-color value.
Returns
The constructed Color.