cppx-core
Namespaces | Classes | Typedefs | Functions | Variables
cppx Namespace Reference

Namespaces

 all_type_builders
 
 ascii
 
 basic_string_building
 
 best_effort
 
 bitlevel
 
 boost_fix
 
 byte_types
 Byte, Signed_byte, as_number, as_std_byte
 
 calc
 Functions and constants typically available on a scientific calculator, but somehow missing from the standard library.
 
 cpp17
 
 cppx
 
 cstdlib
 
 debug
 
 fs_util
 
 hf
 
 hopefully_and_fail
 
 impl
 
 number_properties
 Concise, clear and consistent number type properties.
 
 ptr_and_ref
 Self-descriptive but more wordy Ptr_ and Ref_ aliases for P_ and R_.
 
 rnd
 
 size_types
 
 std
 
 string_repeat
 
 type_assemblers
 Type_, P_, R_, Raw_array_, Raw_array_of_
 
 type_makers
 Type_choice_, Unptr_, Unref_, Signed_, Unsigned_, Const_, Unconst_ and Array_of_.
 
 unicode
 
 utf16
 
 utf32
 
 utf8
 

Classes

class  Abstract_source_location
 
class  Count_iterator_
 
class  Enumerated_
 
class  Forward_iterator_impl_
 
class  Has_method_empty_
 
struct  Head_t_
 
struct  Head_t_< Type_list_< A_type, More_types... > >
 
class  In_out_ref_
 
struct  Joined_t_
 
struct  Joined_t_< Type_list_< Pack_1... >, Type_list_< Pack_2... > >
 
class  Map_
 
class  Matrix_
 
class  No_copy
 
class  No_copy_or_move
 
struct  Number_properties_
 The property values as members of class, so that they can be inherited in. More...
 
class  Range_
 
class  Set_
 
class  Sorted_map_
 
class  Sorted_set_
 
class  Source_location
 
class  Span_
 
class  String_value_view_
 
struct  Tail_t_
 
struct  Tail_t_< Type_list_< A_type, More_types... > >
 
class  Truth
 A drop-in replacement for bool without implicit conversion from/to types other than bool. More...
 
struct  Type_list_
 

Typedefs

using Range = Range_< int >
 
template<class Item >
using Raw_array_span_ = Span_< P_< Item > >
 
using String_value_view = String_value_view_< char >
 
using WString_value_view = String_value_view_< wchar_t >
 
template<class Some_type >
using Type_ = Some_type
 Makes a C style type specification substitutable. More...
 
template<class Some_type >
using P_ = Some_type *
 Creates a raw pointer type. More...
 
template<class Some_type >
using R_ = Some_type &
 Included for completeness, creates an lvalue reference type. More...
 
template<class Item >
using Raw_array_ = Item[]
 Ceates a raw array type of unknown size. More...
 
template<size_t n, class Item >
using Raw_array_of_ = Item[n]
 Creates a raw array type of a specified size. More...
 
template<bool condition, class Result = void>
using Enable_if_ = std::enable_if_t< condition, Result >
 Just more readable than enable_if_t. More...
 
using Byte = unsigned char
 Default choice of byte type. More...
 
using Signed_byte = signed char
 
template<class Char >
using C_str_ = P_< Const_< Char > >
 
template<class Char >
using Mutable_c_str_ = P_< Unconst_< Char > >
 
using C_str = C_str_< char >
 
using Wide_c_str = C_str_< wchar_t >
 
using Mutable_c_str = Mutable_c_str_< char >
 
using Mutable_wide_c_str = Mutable_c_str_< wchar_t >
 
template<int n_bits>
using Int_ = ...
 Signed integer types parameterized by exact width in bits. More...
 
template<int n_bits>
using Unsigned_int_ = Unsigned_< Int_< n_bits > >
 Unsigned integer types parameterized by exact width in bits. More...
 
using Size = Signed_< size_t >
 A Signed_ equivalent of size_t. More...
 
using Index = Size
 Same as Size but with name signifying use as index. More...
 
using Unsigned_size = size_t
 
using Unsigned_index = Unsigned_size
 
template<bool condition, class A , class B >
using Type_choice_ = std::conditional_t< condition, A, B >
 Reduces to type A if the condition holds, otherwise type B. More...
 
template<class Some_pointer_type >
using Unptr_ = std::remove_pointer_t< Some_pointer_type >
 Reduces a type T* to just T. More...
 
template<class Some_reference_type >
using Unref_ = std::remove_reference_t< Some_reference_type >
 Reduces a type T& or T&& to just T. More...
 
template<class Integer >
using Signed_ = std::make_signed_t< Integer >
 For an integer type, produces the corresponding signed type. More...
 
template<class Integer >
using Unsigned_ = std::make_unsigned_t< Integer >
 For an integer type, produces the corresponding unsigned type. More...
 
template<class Some_type >
using Const_ = std::add_const_t< Some_type >
 For a type T produces const T. More...
 
template<class Some_type >
using Unconst_ = std::remove_const_t< Some_type >
 For a type const T produces plain T. More...
 
template<size_t n, class Item >
using Array_of_ = std::array< Item, n >
 Array_of_<n, T> is just more left-to-right direction readable than std::array<T, n>, which is the type it produces. More...
 
template<class A_type_list >
using Head_ = typename Head_t_< A_type_list >::T
 
template<class A_type_list >
using Tail_ = typename Tail_t_< A_type_list >::T
 
template<class Type_list_1 , class Type_list_2 >
using Joined_ = typename Joined_t_< Type_list_1, Type_list_2 >::T
 
using Char_variant_types = Type_list_< unsigned char, signed char >
 
using Byte_char_types = Type_list_< char, unsigned char, signed char >
 
using Cpp03_char_literal_types = Type_list_< char, wchar_t >
 
using Char_literal_types_introduced_in_11 = Type_list_< char16_t, char32_t >
 
using Cpp11_char_literal_types = Joined_< Cpp03_char_literal_types, Char_literal_types_introduced_in_11 >
 
template<class Iterator >
using Item_for_iterator_ = typename std::iterator_traits< Iterator >::value_type
 
template<class Collection >
using Item_for_collection_ = Unref_< decltype(*begin(declval< Collection & >()))>
 
template<class Collection >
using Iterator_for_ = decltype(begin(declval< Collection & >()))
 
using Timer_clock = conditional_t< chrono::high_resolution_clock::is_steady, chrono::high_resolution_clock, chrono::steady_clock >
 

Functions

 CPPX_USE_STD (basic_string, basic_string_view, bitset, char_traits, size)
 
template<class Collection >
constexpr auto n_items_of (const Collection &c) noexcept -> Size
 
template<size_t n>
auto n_items_of (const bitset< n > &bits) noexcept -> Size
 
template<class Char >
auto length_of (const P_< const Char > s) noexcept -> Size
 
template<class Char >
auto length_of (const basic_string< Char > &s) noexcept -> Size
 
template<class Char >
auto length_of (const basic_string_view< Char > &sv) noexcept -> Size
 
 CPPX_USE_STD (declval, initializer_list)
 
template<class Collection >
auto enumerated (Collection &c) -> Enumerated_< Collection >
 
template<class Item >
auto enumerated (const initializer_list< Item > &list) -> Enumerated_< const initializer_list< Item >>
 
 CPPX_USE_STD (begin, end, declval, true_type, false_type)
 
template<class Collection >
auto is_empty (const Collection &c) -> Truth
 
auto is_empty (const P_< const char > s) -> Truth
 
auto is_empty (const P_< const wchar_t > s) -> Truth
 
auto is_empty (const P_< const char16_t > s) -> Truth
 
auto is_empty (const P_< const char32_t > s) -> Truth
 
 CPPX_USE_STD (basic_string_view, begin, binary_search, bitset, end, find, initializer_list)
 
template<class Char >
auto is_in (const basic_string_view< Char > &sv, const Char ch) noexcept -> Truth
 
template<class Item , class Value >
auto is_in (const initializer_list< Item > &items, const Value &v) noexcept -> Truth
 
template<size_t n>
auto is_in (const bitset< n > &bits, const int i) noexcept -> Truth
 
template<class It , class Arg >
auto is_in_span (const It begin, const It end, const Arg &v) -> Truth
 
template<class Key , Size n, class Arg >
auto is_in (Raw_array_of_< n, const Key > &a, const Arg &v) -> Truth
 
template<class It , class Arg >
auto is_in_sorted_span (const It begin, const It end, const Arg &v) -> Truth
 
template<class Key , Size n, class Arg >
auto is_in_sorted (Raw_array_of_< n, const Key > &a, const Arg &v) -> Truth
 
 CPPX_USE_STD (unordered_map)
 
template<class Key , class Value , class Arg >
auto is_in (const unordered_map< Key, Value > &map, const Arg &v) -> Truth
 
 CPPX_USE_STD (out_of_range, vector)
 
template<class Integer >
void reversed (const Range_< Integer > &)=delete
 
template<class Integer = int>
constexpr auto up_to (const Integer n) noexcept -> Range_< Integer >
 
template<class Integer >
auto is_in (const Range_< Integer > &range, const Integer v) -> Truth
 
 CPPX_USE_STD (initializer_list, move, unordered_set)
 
template<class Key , class Arg >
auto is_in (const unordered_set< Key > &set, const Arg &v) -> Truth
 
template<class Key >
auto as_set (const Key &a_key) -> Set_< Key >
 
template<class Integer >
auto as_set (const Range_< Integer > range) -> Set_< Integer >
 
template<class Key >
auto as_set (const initializer_list< Key > &values) -> Set_< Key >
 
template<class Key >
auto set_union (const unordered_set< Key > &a, const unordered_set< Key > &b) -> Set_< Key >
 
template<class Key , class Arg >
auto set_union (const unordered_set< Key > &a, const Arg &b) -> Set_< Key >
 
template<class Key , class Arg >
auto set_union (const Arg &a, const unordered_set< Key > &b) -> Set_< Key >
 
template<class Key >
auto set_difference (const unordered_set< Key > &a, const unordered_set< Key > &b) -> Set_< Key >
 
template<class Key , class Arg >
auto set_difference (const unordered_set< Key > &a, const Arg &b) -> Set_< Key >
 
template<class Key >
auto set_intersection (const unordered_set< Key > &a, const unordered_set< Key > &b) -> Set_< Key >
 
template<class Key >
auto set_difference (Set_< Key > &&a, const unordered_set< Key > &b) -> Set_< Key > &&
 
 CPPX_USE_STD (map)
 
template<class Key , class Value , class Arg >
auto is_in (const Sorted_map_< Key, Value > &map, const Arg &v) -> Truth
 
 CPPX_USE_STD (initializer_list, move, set)
 
template<class Key , class Arg >
auto is_in (const set< Key > &set, const Arg &v) -> Truth
 
template<class Key >
auto as_sorted_set (const Key &a_key) -> Sorted_set_< Key >
 
template<class Integer >
auto as_sorted_set (const Range_< Integer > range) -> Sorted_set_< Integer >
 
template<class Key >
auto as_sorted_set (const initializer_list< Key > &values) -> Sorted_set_< Key >
 
template<class Key >
auto set_union (const set< Key > &a, const set< Key > &b) -> Sorted_set_< Key >
 
template<class Key , class Arg >
auto set_union (const set< Key > &a, const Arg &b) -> Sorted_set_< Key >
 
template<class Key , class Arg >
auto set_union (const Arg &a, const set< Key > &b) -> Sorted_set_< Key >
 
template<class Key >
auto set_difference (const set< Key > &a, const set< Key > &b) -> Sorted_set_< Key >
 
template<class Key , class Arg >
auto set_difference (const set< Key > &a, const Arg &b) -> Sorted_set_< Key >
 
template<class Key >
auto set_intersection (const set< Key > &a, const set< Key > &b) -> Sorted_set_< Key >
 
template<class Key >
auto set_difference (Sorted_set_< Key > &&a, const set< Key > &b) -> Sorted_set_< Key > &&
 
 CPPX_USE_STD (begin, declval, distance, end, make_reverse_iterator, move, next, prev, queue, reverse_iterator, stack)
 
template<class Collection >
auto it_begin_of (Collection &&c)
 
template<class Collection >
auto it_end_of (Collection &&c)
 
template<class Iterator >
auto n_items_of (const Span_< Iterator > &range) -> Size
 
template<class Iterator >
auto span_of (const Iterator first, const Iterator beyond) -> Span_< Iterator >
 
template<class Container >
auto all_of (Container &&c) -> Span_< decltype(begin(c))>
 
template<class Item , class Container >
auto all_of (const queue< Item, Container > &q) -> Span_< decltype(begin(declval< const Container >()))>
 
template<class Item , class Container >
auto all_of (const stack< Item, Container > &st) -> Span_< decltype(begin(declval< const Container >()))>
 
template<class Container >
auto all_but_first_of (Container &&c) -> Span_< decltype(begin(c))>
 
template<class Container >
auto all_but_first_n_of (Container &&c, const Size n) -> Span_< decltype(begin(c))>
 
template<class Container >
auto all_but_last_of (Container &&c) -> Span_< decltype(begin(c))>
 
template<class Char , Size n>
auto text_span_of_literal (const Raw_array_of_< n, const Char > &string_literal) -> Span_< P_< const Char >>
 
template<class Container >
auto all_but_last_n_of (Container &&c, const Size n) -> Span_< decltype(begin(c))>
 
template<class Container >
auto reversed (Container &&c) -> Span_< reverse_iterator< decltype(begin(c))>>
 
 CPPX_USE_STD (basic_string, basic_string_view)
 
template<class Char >
auto is_empty (const String_value_view_< Char > &svv) -> Truth
 
 CPPX_USE_STD (string, string_view, to_string)
 
auto to_string (const Abstract_source_location &loc) -> string
 
 CPPX_USE_STD (exception_ptr, rethrow_exception)
 
auto replace_stored_x_with (const exception_ptr &p) -> exception_ptr
 
void clear_stored_x ()
 
void rethrow_any_stored_x ()
 
 CPPX_USE_STD (exception, function, move, rethrow_if_nested, string)
 
void call_with_description_lines_from (const exception &x, const function< void(const C_str)> &f)
 
auto description_lines_from (const exception &x) -> string
 
void dbginfo (const String_value_view &)
 
 CPPX_USE_STD (string, move, optional)
 
 CPPX_USE_STD (string, string_view)
 
auto monospaced_bullet_block (const string_view &s, const string_view &bullet=best_effort::bullet_str, const int indent_size=4) -> string
 
 CPPX_USE_STD (forward_iterator_tag)
 
 CPPX_USE_STD (numeric_limits)
 
template<class Unsigned >
constexpr auto intlog2 (const Unsigned x) noexcept -> int
 The position of the most significant bit in an unsigned value, or -1 for value zero. More...
 
template<int n>
auto sum_of_bits (const bitset< n > &bits) noexcept -> int
 The number of 1-bits in a std::bitset. More...
 
template<class Unsigned >
auto sum_of_bits (const uint16_t x) noexcept -> int
 The number of 1-bits in an unsigned value. More...
 
template<class Number = double>
auto intpow (const Number base, const int exponent) -> Number
 Efficient x to the n'th power, when n is an integer. More...
 
auto squared (const double x) -> double
 The square (second power) of the argument. More...
 
auto cubed (const double x) -> double
 The cube (third power) of the argument. More...
 
template<class Int >
auto is_even (const Int x) -> Truth
 
template<class Int >
auto is_odd (const Int x) -> Truth
 
template<class Int >
auto intdiv (const Int a, const Int b) noexcept -> Int
 
auto intmod (const int a, const int b) noexcept -> int
 
template<class Int = int>
auto intsquare (const Int x) -> Int
 
template<class Int = int>
auto intcube (const Int x) -> Int
 
template<class... Ints>
auto intmin (const Ints... args) -> std::common_type_t< Ints... >
 
template<class... Ints>
auto intmax (const Ints... args) -> std::common_type_t< Ints... >
 
template<class Number >
constexpr auto nan_ () -> Number
 
constexpr auto nan () -> double
 
template<class Number >
constexpr auto infinity_ () -> Number
 
constexpr auto infinity () -> double
 
auto as_number (const std::byte value) -> Byte
 
auto as_std_byte (const Byte value) -> std::byte
 
 CPPX_USE_STD (array, bitset)
 
template<class Item , size_t n>
constexpr auto array_size_of (const Raw_array_of_< n, Item > &) noexcept -> Size
 
template<class Item , size_t n>
constexpr auto array_size_of (const array< Item, n > &) noexcept -> Size
 
template<class Item , size_t n>
constexpr auto array_size_of (const bitset< n > &) noexcept -> Size
 
template<class Char , Size n>
constexpr auto length_of_literal (Raw_array_of_< n, const Char > &s) noexcept -> Size
 
 CPPX_USE_STD (enable_if_t, is_same_v)
 
template<class Type >
auto only_lvalue_ref_to (Type &c) -> Type &
 A helper for restricting macro arguments, used e.g. in $items_of. More...
 
template<class Derived , class Type , class = Enable_if_<is_base_and_derived_<Type, Derived>>>
auto downcasted_to_ (P_< Type > p) -> P_< Derived >
 
template<class Derived , class Type , class = Enable_if_<is_base_and_derived_<Type, Derived>>>
auto is_of_derived_class_ (const Type &o) -> Truth
 
 CPPX_USE_STD (begin, declval)
 
 CPPX_USE_STD_NAMESPACE_NAMES (chrono)
 
 CPPX_USE_STD (conditional_t, milli, micro, nano)
 
template<class Rep , class Period >
auto as_seconds (const chrono::duration< Rep, Period > duration_value) -> double
 
template<class Rep , class Period >
auto as_milliseconds (const chrono::duration< Rep, Period > duration_value) -> double
 
template<class Rep , class Period >
auto as_microseconds (const chrono::duration< Rep, Period > duration_value) -> double
 
template<class Rep , class Period >
auto as_nanoseconds (const chrono::duration< Rep, Period > duration_value) -> double
 
 CPPX_USE_STD (copy, exchange, string)
 
 CPPX_USE_STD (forward)
 
template<class Func , class... Args>
void repeat (const Size n, const Func &f, Args &&... args)
 
 CPPX_USE_STD (ref, reference_wrapper)
 
template<class Type , class = Enable_if_<not is_const_<Type>>>
auto in_out_ref (Type &o) -> In_out_ref_< Type >
 
 CPPX_USE_STD (ostringstream, string, string_view)
 
 CPPX_USE_STD (basic_string_view)
 
template<class Char >
auto p_first_of (const basic_string_view< Char > &view) noexcept -> C_str_< Char >
 
template<class Char >
auto p_beyond_of (const basic_string_view< Char > &view) noexcept -> C_str_< Char >
 
 CPPX_USE_STD (basic_string_view, move, next, string, string_view)
 
auto spaces (const int n) -> string
 
auto left (const string_view &s, const int width) -> string
 
auto right (const string_view &s, const int width) -> string
 
auto quoted (const string_view &sv) -> string
 
auto quoted (const char ch) -> string
 
auto trimmed (const string_view &sv) -> string_view
 
auto trimmed (const string &s) -> string
 
auto trimmed (string &&s) -> string
 
auto split () -> void
 
template<class Iterator >
auto joined (const Span_< Iterator > range, const string &separator=" ") -> string
 

Variables

template<class Collection >
constexpr Truth has_method_empty_ = Has_method_empty_<Collection>::value
 
constexpr Truth check_the_execution_character_set = true
 
constexpr Truth use_ascii_substitutes = false
 
const int bits_per_byte = CHAR_BIT
 Usually 8, but e.g. 16 on some DSPs. More...
 
template<class Type >
constexpr int bits_per_ = sizeof( Type )*bits_per_byte
 The number of bits per object/value of the specified type. More...
 
template<class Type >
constexpr int magnitude_bits_per_ = numeric_limits<Type>::digits
 The number of bits that determine the magnitude, i.e. the number of value representation bits minus a sign bit, if any. More...
 
const auto e = 2.71828182845904523536
 
const auto log2e = 1.44269504088896340736
 
const auto log10e = 0.434294481903251827651
 
const auto ln2 = 0.693147180559945309417
 
const auto ln10 = 2.30258509299404568402
 
const auto pi = 3.14159265358979323846
 
const auto inv_sqrt_pi = 1.12837916709551257390
 
const auto sqrt2 = 1.41421356237309504880
 
const auto inv_sqrt2 = 0.707106781186547524401
 
template<class Number = double>
constexpr Truth has_nan_ = numeric_limits<Number>::has_quiet_NaN
 
constexpr Truth has_nan = has_nan_<double>
 
template<class Number = double>
constexpr Truth has_infinity_ = numeric_limits<double>::has_infinity
 
constexpr Truth has_infinity = has_infinity_<double>
 
template<class T >
constexpr Truth is_ieee_754_
 FP only. Whether the implementation claims to conform to the IEEE 754 standard. More...
 
template<class T >
constexpr T largest_
 The largest representable-as-positive absolute value of the type. More...
 
template<class T >
constexpr T smallest_
 The smallest non-zero absolute value of the type. More...
 
template<class T >
constexpr T max_
 The largest positive value of the type. More...
 
template<class T >
constexpr T min_
 The largest negative value of the type. More...
 
template<class T >
constexpr int max_e_
 FP only. E-notation maximum (largest positive) exponent value. More...
 
template<class T >
constexpr int min_e_
 FP only. E-notation minimum (largest negative) exponent value. More...
 
template<class T >
constexpr int n_digits_
 Number of decimal digits that guaranteed can be represented. More...
 
template<class T >
constexpr int radix_
 FP only. The numeral system base of the floating point representation, 2 or 10. More...
 
template<class T >
constexpr T epsilon_
 The difference between 1 and the least floating point value greater than 1. More...
 
template<class Base , class Derived >
constexpr Truth is_base_and_derived_ = std::is_base_of_v<Base, Derived>
 
template<class T , class U >
constexpr Truth is_same_type_ = std::is_same_v<T, U>
 
template<class T , class U >
constexpr Truth is_a_ = is_same_type_<T, U> or is_base_and_derived_<T, U>
 
template<class T >
constexpr Truth is_const_ = std::is_const_v<std::remove_reference_t<T>>
 
template<class T >
constexpr Truth is_class_ = std::is_class_v<T>
 
template<class T >
constexpr Truth is_fixed_point_ = false
 
template<class T >
constexpr Truth is_floating_point_ = std::is_floating_point_v<T>
 
template<class T >
constexpr Truth is_integral_ = std::is_integral_v<T>
 
template<class Int >
constexpr Truth is_signed_ = std::is_signed_v<Int>
 
template<class Int >
constexpr Truth is_unsigned_ = std::is_unsigned_v<Int>
 
template<class Some_type , class Type_list >
constexpr bool contains_type_
 
template<class Possible_subset , class Main_set >
constexpr bool contains_type_subset_
 
template<class Char >
constexpr Truth is_a_cpp03_char_type_ = contains_type_<Char, Cpp03_char_literal_types>
 
template<class Char >
constexpr Truth is_a_cpp11_char_type_ = contains_type_<Char, Cpp11_char_literal_types>
 
template<class Char >
constexpr Truth is_a_char_type_ = is_a_cpp11_char_type_<Char>
 
template<class Char >
constexpr Truth is_a_char_variant_type_ = contains_type_<Char, Char_variant_types>
 
template<class Char >
constexpr Truth is_a_byte_char_type_ = contains_type_<Char, Byte_char_types>
 
const char std_ascii_bad_char = ascii::end_of_text
 
const wchar_t std_unicode_bad_char = L'\uFFFD'
 
template<class Char >
constexpr Raw_array_of_< 1, const Char > empty_c_string = {}
 

Detailed Description

Common math/calculator constants: e, log2e, log10e, ln2, ln10, pi, inv_sqrt_pi, sqrt2, inv_sqrt2, has_nan_ and has_nan, nan_ and nan, has_infinity_ and has_infinity, infinity_ and infinity.

The template aliases defined in this file generally do not support template argument deduction. In contrast, the basic type assemblers like P_ and R_, do. Those basic type assemblers are also offered by this header, via a convenience include of <cppx-core/language/syntax/type-assemblers.hpp>.

Typedef Documentation

◆ Array_of_

template<size_t n, class Item >
using cppx::Array_of_ = typedef std::array<Item, n>

Array_of_<n, T> is just more left-to-right direction readable than std::array<T, n>, which is the type it produces.

Definition at line 65 of file type-makers.hpp.

◆ Byte

using cppx::Byte = typedef unsigned char

Default choice of byte type.

Definition at line 19 of file byte-types.hpp.

◆ Byte_char_types

using cppx::Byte_char_types = typedef Type_list_<char, unsigned char, signed char>

Definition at line 18 of file type-traits.hpp.

◆ C_str

using cppx::C_str = typedef C_str_<char>

Definition at line 38 of file C_str_.hpp.

◆ C_str_

template<class Char >
using cppx::C_str_ = typedef P_<Const_<Char> >

Definition at line 33 of file C_str_.hpp.

◆ Char_literal_types_introduced_in_11

using cppx::Char_literal_types_introduced_in_11 = typedef Type_list_<char16_t, char32_t>

Definition at line 22 of file type-traits.hpp.

◆ Char_variant_types

using cppx::Char_variant_types = typedef Type_list_<unsigned char, signed char>

Definition at line 17 of file type-traits.hpp.

◆ Const_

template<class Some_type >
using cppx::Const_ = typedef std::add_const_t< Some_type >

For a type T produces const T.

Definition at line 53 of file type-makers.hpp.

◆ Cpp03_char_literal_types

using cppx::Cpp03_char_literal_types = typedef Type_list_<char, wchar_t>

Definition at line 20 of file type-traits.hpp.

◆ Cpp11_char_literal_types

Definition at line 27 of file type-traits.hpp.

◆ Enable_if_

template<bool condition, class Result = void>
using cppx::Enable_if_ = typedef std::enable_if_t<condition, Result>

Just more readable than enable_if_t.

Definition at line 12 of file basic-Enable_if_.hpp.

◆ Head_

template<class A_type_list >
using cppx::Head_ = typedef typename Head_t_<A_type_list>::T

Definition at line 22 of file Type_list_.hpp.

◆ Index

using cppx::Index = typedef Size

Same as Size but with name signifying use as index.

Definition at line 32 of file signed-size-types.hpp.

◆ Int_

template<int n_bits>
using cppx::Int_ = typedef ...

Signed integer types parameterized by exact width in bits.

Parameters
n_bitsbe 8, 16, 32 or 64.

Definition at line 26 of file Int_.hpp.

◆ Item_for_collection_

template<class Collection >
using cppx::Item_for_collection_ = typedef Unref_<decltype( *begin( declval<Collection&>() ) )>

Definition at line 53 of file type-traits.hpp.

◆ Item_for_iterator_

template<class Iterator >
using cppx::Item_for_iterator_ = typedef typename std::iterator_traits<Iterator>::value_type

Definition at line 50 of file type-traits.hpp.

◆ Iterator_for_

template<class Collection >
using cppx::Iterator_for_ = typedef decltype( begin( declval<Collection&>() ) )

Definition at line 56 of file type-traits.hpp.

◆ Joined_

template<class Type_list_1 , class Type_list_2 >
using cppx::Joined_ = typedef typename Joined_t_<Type_list_1, Type_list_2>::T

Definition at line 48 of file Type_list_.hpp.

◆ Mutable_c_str

using cppx::Mutable_c_str = typedef Mutable_c_str_<char>

Definition at line 40 of file C_str_.hpp.

◆ Mutable_c_str_

template<class Char >
using cppx::Mutable_c_str_ = typedef P_<Unconst_<Char> >

Definition at line 36 of file C_str_.hpp.

◆ Mutable_wide_c_str

using cppx::Mutable_wide_c_str = typedef Mutable_c_str_<wchar_t>

Definition at line 41 of file C_str_.hpp.

◆ P_

template<class Some_type >
using cppx::P_ = typedef Some_type*

Creates a raw pointer type.

P_<T> is the type denoted by Type_<T>*, wrapped up. It's equivalent to writing Type_<Type_<T>*>. Except for missing template argument deduction ability and added verbosity it can also be expressed as std::add_pointer_t<T>.

Definition at line 54 of file type-assemblers.hpp.

◆ R_

template<class Some_type >
using cppx::R_ = typedef Some_type&

Included for completeness, creates an lvalue reference type.

R_<T> is the type denoted by Type_<T>&, wrapped up. It's equivalent to writing Type_<Type_<T>&>. Except for missing template argument deduction and added verbosity it can also be expressed as std::add_lvalue_reference_t<T>.

Preferably write just T& or Type_<T>&, and not the less eye-friendly R_<T>.

Definition at line 64 of file type-assemblers.hpp.

◆ Range

using cppx::Range = typedef Range_<int>

Definition at line 55 of file Range_.hpp.

◆ Raw_array_

template<class Item >
using cppx::Raw_array_ = typedef Item[]

Ceates a raw array type of unknown size.

Raw_array_<T> is the type denoted by Type_<T>[], wrapped up. It's equivalent to writing Type_<Type_<T>[]>. The C++17 standard library provides no notation for this.

A raw array of unknown size can acquire a size via an initializer, e.g. const Raw_array_of<int> numbers = {1, 2, 3}; (where the size is then 3).

Definition at line 75 of file type-assemblers.hpp.

◆ Raw_array_of_

template<size_t n, class Item >
using cppx::Raw_array_of_ = typedef Item[n]

Creates a raw array type of a specified size.

Raw_array_of_<n, T> is the type denoted by Type_<T>[n], wrapped up. It's equivalent to writing Type_<Type_<T>[n]>. The C++17 standard library provides no notation for this.

Definition at line 83 of file type-assemblers.hpp.

◆ Raw_array_span_

template<class Item >
using cppx::Raw_array_span_ = typedef Span_<P_<Item> >

Definition at line 66 of file Span_.hpp.

◆ Signed_

template<class Integer >
using cppx::Signed_ = typedef std::make_signed_t< Integer >

For an integer type, produces the corresponding signed type.

Definition at line 45 of file type-makers.hpp.

◆ Signed_byte

using cppx::Signed_byte = typedef signed char

Definition at line 20 of file byte-types.hpp.

◆ Size

using cppx::Size = typedef Signed_< size_t >

A Signed_ equivalent of size_t.

Definition at line 29 of file signed-size-types.hpp.

◆ String_value_view

Definition at line 56 of file String_value_view_.hpp.

◆ Tail_

template<class A_type_list >
using cppx::Tail_ = typedef typename Tail_t_<A_type_list>::T

Definition at line 33 of file Type_list_.hpp.

◆ Timer_clock

using cppx::Timer_clock = typedef conditional_t<chrono::high_resolution_clock::is_steady, chrono::high_resolution_clock, chrono::steady_clock >

Definition at line 20 of file chrono-util.hpp.

◆ Type_

template<class Some_type >
using cppx::Type_ = typedef Some_type

Makes a C style type specification substitutable.

Type_<T> is the type denoted by the type expression T, wrapped up so that other type builders (e.g. const) can be applied to it.

E.g. instead of the difficult-to-parse

int (& (*const fp)())[42];

you can write it with prefix const as

const Type_<Type_<auto()->int(&)[42]>*> fp;

although for this particular example using the P_ type builder is more clean:

const P_<auto()->int(&)[42]> fp;

Credit: I first saw a template like Type_ suggested by Johannes “litb” Schaub.

Definition at line 46 of file type-assemblers.hpp.

◆ Type_choice_

template<bool condition, class A , class B >
using cppx::Type_choice_ = typedef std::conditional_t<condition, A, B>

Reduces to type A if the condition holds, otherwise type B.

Parameters
conditionA compile time boolean expression.
AResult type when the condition holds.
BResult type when the condition doesn't hold.

Definition at line 33 of file type-makers.hpp.

◆ Unconst_

template<class Some_type >
using cppx::Unconst_ = typedef std::remove_const_t< Some_type >

For a type const T produces plain T.

Definition at line 57 of file type-makers.hpp.

◆ Unptr_

template<class Some_pointer_type >
using cppx::Unptr_ = typedef std::remove_pointer_t<Some_pointer_type>

Reduces a type T* to just T.

Definition at line 37 of file type-makers.hpp.

◆ Unref_

template<class Some_reference_type >
using cppx::Unref_ = typedef std::remove_reference_t<Some_reference_type>

Reduces a type T& or T&& to just T.

Definition at line 41 of file type-makers.hpp.

◆ Unsigned_

template<class Integer >
using cppx::Unsigned_ = typedef std::make_unsigned_t< Integer >

For an integer type, produces the corresponding unsigned type.

Definition at line 49 of file type-makers.hpp.

◆ Unsigned_index

Definition at line 35 of file signed-size-types.hpp.

◆ Unsigned_int_

template<int n_bits>
using cppx::Unsigned_int_ = typedef Unsigned_<Int_<n_bits> >

Unsigned integer types parameterized by exact width in bits.

Definition at line 32 of file Int_.hpp.

◆ Unsigned_size

using cppx::Unsigned_size = typedef size_t

Definition at line 34 of file signed-size-types.hpp.

◆ Wide_c_str

using cppx::Wide_c_str = typedef C_str_<wchar_t>

Definition at line 39 of file C_str_.hpp.

◆ WString_value_view

using cppx::WString_value_view = typedef String_value_view_<wchar_t>

Definition at line 57 of file String_value_view_.hpp.

Function Documentation

◆ all_but_first_n_of()

template<class Container >
auto cppx::all_but_first_n_of ( Container &&  c,
const Size  n 
) -> Span_<decltype( begin( c ) )>
inline

Definition at line 120 of file Span_.hpp.

◆ all_but_first_of()

template<class Container >
auto cppx::all_but_first_of ( Container &&  c) -> Span_<decltype( begin( c ) )>
inline

Definition at line 112 of file Span_.hpp.

◆ all_but_last_n_of()

template<class Container >
auto cppx::all_but_last_n_of ( Container &&  c,
const Size  n 
) -> Span_<decltype( begin( c ) )>
inline

Definition at line 144 of file Span_.hpp.

◆ all_but_last_of()

template<class Container >
auto cppx::all_but_last_of ( Container &&  c) -> Span_<decltype( begin( c ) )>
inline

Definition at line 128 of file Span_.hpp.

◆ all_of() [1/3]

template<class Container >
auto cppx::all_of ( Container &&  c) -> Span_<decltype( begin( c ) )>
inline

Definition at line 79 of file Span_.hpp.

◆ all_of() [2/3]

template<class Item , class Container >
auto cppx::all_of ( const queue< Item, Container > &  q) -> Span_<decltype( begin( declval<const Container>() ) )>

Definition at line 84 of file Span_.hpp.

◆ all_of() [3/3]

template<class Item , class Container >
auto cppx::all_of ( const stack< Item, Container > &  st) -> Span_<decltype( begin( declval<const Container>() ) )>

Definition at line 98 of file Span_.hpp.

◆ array_size_of() [1/3]

template<class Item , size_t n>
constexpr auto cppx::array_size_of ( const Raw_array_of_< n, Item > &  ) -> Size
noexcept

Definition at line 24 of file fixed-size-checking.hpp.

◆ array_size_of() [2/3]

template<class Item , size_t n>
constexpr auto cppx::array_size_of ( const array< Item, n > &  ) -> Size
noexcept

Definition at line 29 of file fixed-size-checking.hpp.

◆ array_size_of() [3/3]

template<class Item , size_t n>
constexpr auto cppx::array_size_of ( const bitset< n > &  ) -> Size
noexcept

Definition at line 34 of file fixed-size-checking.hpp.

◆ as_microseconds()

template<class Rep , class Period >
auto cppx::as_microseconds ( const chrono::duration< Rep, Period >  duration_value) -> double
inline

Definition at line 33 of file chrono-util.hpp.

◆ as_milliseconds()

template<class Rep , class Period >
auto cppx::as_milliseconds ( const chrono::duration< Rep, Period >  duration_value) -> double
inline

Definition at line 28 of file chrono-util.hpp.

◆ as_nanoseconds()

template<class Rep , class Period >
auto cppx::as_nanoseconds ( const chrono::duration< Rep, Period >  duration_value) -> double
inline

Definition at line 38 of file chrono-util.hpp.

◆ as_number()

auto cppx::as_number ( const std::byte  value) -> Byte
inline

Definition at line 22 of file byte-types.hpp.

◆ as_seconds()

template<class Rep , class Period >
auto cppx::as_seconds ( const chrono::duration< Rep, Period >  duration_value) -> double
inline

Definition at line 23 of file chrono-util.hpp.

◆ as_set() [1/3]

template<class Key >
auto cppx::as_set ( const Key &  a_key) -> Set_<Key>
inline

Definition at line 65 of file Set_.hpp.

◆ as_set() [2/3]

template<class Integer >
auto cppx::as_set ( const Range_< Integer >  range) -> Set_<Integer>
inline

Definition at line 70 of file Set_.hpp.

◆ as_set() [3/3]

template<class Key >
auto cppx::as_set ( const initializer_list< Key > &  values) -> Set_<Key>
inline

Definition at line 75 of file Set_.hpp.

◆ as_sorted_set() [1/3]

template<class Key >
auto cppx::as_sorted_set ( const Key &  a_key) -> Sorted_set_<Key>
inline

Definition at line 65 of file Sorted_set_.hpp.

◆ as_sorted_set() [2/3]

template<class Integer >
auto cppx::as_sorted_set ( const Range_< Integer >  range) -> Sorted_set_<Integer>
inline

Definition at line 70 of file Sorted_set_.hpp.

◆ as_sorted_set() [3/3]

template<class Key >
auto cppx::as_sorted_set ( const initializer_list< Key > &  values) -> Sorted_set_<Key>
inline

Definition at line 75 of file Sorted_set_.hpp.

◆ as_std_byte()

auto cppx::as_std_byte ( const Byte  value) -> std::byte
inline

Definition at line 26 of file byte-types.hpp.

◆ call_with_description_lines_from()

void cppx::call_with_description_lines_from ( const exception &  x,
const function< void(const C_str)> &  f 
)
inline

Definition at line 15 of file exception-unwrapping.hpp.

◆ clear_stored_x()

void cppx::clear_stored_x ( )
inline

Definition at line 32 of file exception-propagation.hpp.

◆ CPPX_USE_STD() [1/28]

cppx::CPPX_USE_STD ( string  ,
string_view   
)

◆ CPPX_USE_STD() [2/28]

cppx::CPPX_USE_STD ( forward  )

◆ CPPX_USE_STD() [3/28]

cppx::CPPX_USE_STD ( unordered_map  )

◆ CPPX_USE_STD() [4/28]

cppx::CPPX_USE_STD ( basic_string_view  )

◆ CPPX_USE_STD() [5/28]

cppx::CPPX_USE_STD ( exception_ptr  ,
rethrow_exception   
)

◆ CPPX_USE_STD() [6/28]

cppx::CPPX_USE_STD ( map  )

◆ CPPX_USE_STD() [7/28]

cppx::CPPX_USE_STD ( ref  ,
reference_wrapper   
)

◆ CPPX_USE_STD() [8/28]

cppx::CPPX_USE_STD ( ostringstream  ,
string  ,
string_view   
)

◆ CPPX_USE_STD() [9/28]

cppx::CPPX_USE_STD ( conditional_t  ,
milli  ,
micro  ,
nano   
)

◆ CPPX_USE_STD() [10/28]

cppx::CPPX_USE_STD ( exception  ,
function  ,
move  ,
rethrow_if_nested  ,
string   
)

◆ CPPX_USE_STD() [11/28]

cppx::CPPX_USE_STD ( begin  ,
end  ,
declval  ,
true_type  ,
false_type   
)

◆ CPPX_USE_STD() [12/28]

cppx::CPPX_USE_STD ( basic_string  ,
basic_string_view  ,
bitset  ,
char_traits  ,
size   
)

◆ CPPX_USE_STD() [13/28]

cppx::CPPX_USE_STD ( basic_string  ,
basic_string_view   
)

◆ CPPX_USE_STD() [14/28]

cppx::CPPX_USE_STD ( out_of_range  ,
vector   
)

◆ CPPX_USE_STD() [15/28]

cppx::CPPX_USE_STD ( basic_string_view  ,
move  ,
next  ,
string  ,
string_view   
)

◆ CPPX_USE_STD() [16/28]

cppx::CPPX_USE_STD ( string  ,
string_view  ,
to_string   
)

◆ CPPX_USE_STD() [17/28]

cppx::CPPX_USE_STD ( numeric_limits  )

◆ CPPX_USE_STD() [18/28]

cppx::CPPX_USE_STD ( initializer_list  ,
move  ,
set   
)

◆ CPPX_USE_STD() [19/28]

cppx::CPPX_USE_STD ( enable_if_t  ,
is_same_v   
)

◆ CPPX_USE_STD() [20/28]

cppx::CPPX_USE_STD ( begin  ,
declval   
)

◆ CPPX_USE_STD() [21/28]

cppx::CPPX_USE_STD ( initializer_list  ,
move  ,
unordered_set   
)

◆ CPPX_USE_STD() [22/28]

cppx::CPPX_USE_STD ( basic_string_view  ,
begin  ,
binary_search  ,
bitset  ,
end  ,
find  ,
initializer_list   
)

◆ CPPX_USE_STD() [23/28]

cppx::CPPX_USE_STD ( declval  ,
initializer_list   
)

◆ CPPX_USE_STD() [24/28]

cppx::CPPX_USE_STD ( begin  ,
declval  ,
distance  ,
end  ,
make_reverse_iterator  ,
move  ,
next  ,
prev  ,
queue  ,
reverse_iterator  ,
stack   
)

◆ CPPX_USE_STD() [25/28]

cppx::CPPX_USE_STD ( array  ,
bitset   
)

◆ CPPX_USE_STD() [26/28]

cppx::CPPX_USE_STD ( string  ,
move  ,
optional   
)

◆ CPPX_USE_STD() [27/28]

cppx::CPPX_USE_STD ( copy  ,
exchange  ,
string   
)

◆ CPPX_USE_STD() [28/28]

cppx::CPPX_USE_STD ( forward_iterator_tag  )

◆ CPPX_USE_STD_NAMESPACE_NAMES()

cppx::CPPX_USE_STD_NAMESPACE_NAMES ( chrono  )

◆ cubed()

auto cppx::cubed ( const double  x) -> double
inline

The cube (third power) of the argument.

Definition at line 62 of file floating-point-operations.hpp.

◆ dbginfo()

void cppx::dbginfo ( const String_value_view )

◆ description_lines_from()

auto cppx::description_lines_from ( const exception &  x) -> string
inline

Definition at line 35 of file exception-unwrapping.hpp.

◆ downcasted_to_()

template<class Derived , class Type , class = Enable_if_<is_base_and_derived_<Type, Derived>>>
auto cppx::downcasted_to_ ( P_< Type >  p) -> P_<Derived>
inline

Definition at line 26 of file downcasted_to_.hpp.

◆ enumerated() [1/2]

template<class Collection >
auto cppx::enumerated ( Collection &  c) -> Enumerated_<Collection>

Definition at line 77 of file Enumerated_.hpp.

◆ enumerated() [2/2]

template<class Item >
auto cppx::enumerated ( const initializer_list< Item > &  list) -> Enumerated_<const initializer_list<Item>>

Definition at line 82 of file Enumerated_.hpp.

◆ in_out_ref()

template<class Type , class = Enable_if_<not is_const_<Type>>>
auto cppx::in_out_ref ( Type &  o) -> In_out_ref_<Type>
inline

Definition at line 35 of file In_out_ref_.hpp.

◆ infinity()

constexpr auto cppx::infinity ( ) -> double
inline

Definition at line 80 of file named-numbers.hpp.

◆ infinity_()

template<class Number >
constexpr auto cppx::infinity_ ( ) -> Number

Definition at line 76 of file named-numbers.hpp.

◆ intcube()

template<class Int = int>
auto cppx::intcube ( const Int  x) -> Int
inline

Definition at line 53 of file integer-operations.hpp.

◆ intdiv()

template<class Int >
auto cppx::intdiv ( const Int  a,
const Int  b 
) -> Int
inlinenoexcept

Definition at line 36 of file integer-operations.hpp.

◆ intlog2()

template<class Unsigned >
constexpr auto cppx::intlog2 ( const Unsigned  x) -> int
inlinenoexcept

The position of the most significant bit in an unsigned value, or -1 for value zero.

Definition at line 52 of file intlog2.hpp.

◆ intmax()

template<class... Ints>
auto cppx::intmax ( const Ints...  args) -> std::common_type_t<Ints...>
inline

Definition at line 66 of file integer-operations.hpp.

◆ intmin()

template<class... Ints>
auto cppx::intmin ( const Ints...  args) -> std::common_type_t<Ints...>
inline

Definition at line 58 of file integer-operations.hpp.

◆ intmod()

auto cppx::intmod ( const int  a,
const int  b 
) -> int
inlinenoexcept

Definition at line 43 of file integer-operations.hpp.

◆ intpow()

template<class Number = double>
auto cppx::intpow ( const Number  base,
const int  exponent 
) -> Number
inline

Efficient x to the n'th power, when n is an integer.

Parameters
baseThe x in “*x* to the n'th”.
exponentThe n in “*x* to the n'th”.

Essentially this is Horner's rule adapted to calculating a power, so that the number of floating point multiplications is at worst O(log2(n)).

Definition at line 46 of file floating-point-operations.hpp.

◆ intsquare()

template<class Int = int>
auto cppx::intsquare ( const Int  x) -> Int
inline

Definition at line 48 of file integer-operations.hpp.

◆ is_empty() [1/6]

template<class Collection >
auto cppx::is_empty ( const Collection &  c) -> Truth
inline

Definition at line 33 of file is_empty.hpp.

◆ is_empty() [2/6]

auto cppx::is_empty ( const P_< const char >  s) -> Truth
inline

Definition at line 46 of file is_empty.hpp.

◆ is_empty() [3/6]

auto cppx::is_empty ( const P_< const wchar_t >  s) -> Truth
inline

Definition at line 47 of file is_empty.hpp.

◆ is_empty() [4/6]

auto cppx::is_empty ( const P_< const char16_t >  s) -> Truth
inline

Definition at line 48 of file is_empty.hpp.

◆ is_empty() [5/6]

auto cppx::is_empty ( const P_< const char32_t >  s) -> Truth
inline

Definition at line 49 of file is_empty.hpp.

◆ is_empty() [6/6]

template<class Char >
auto cppx::is_empty ( const String_value_view_< Char > &  svv) -> Truth
inline

Definition at line 52 of file String_value_view_.hpp.

◆ is_even()

template<class Int >
auto cppx::is_even ( const Int  x) -> Truth
inline

Definition at line 26 of file integer-operations.hpp.

◆ is_in() [1/9]

template<class Char >
auto cppx::is_in ( const basic_string_view< Char > &  sv,
const Char  ch 
) -> Truth
inlinenoexcept

Definition at line 21 of file is_in.hpp.

◆ is_in() [2/9]

template<class Item , class Value >
auto cppx::is_in ( const initializer_list< Item > &  items,
const Value &  v 
) -> Truth
inlinenoexcept

Definition at line 26 of file is_in.hpp.

◆ is_in() [3/9]

template<class Key , class Value , class Arg >
auto cppx::is_in ( const Sorted_map_< Key, Value > &  map,
const Arg &  v 
) -> Truth

Definition at line 27 of file Sorted_map_.hpp.

◆ is_in() [4/9]

template<class Key , class Value , class Arg >
auto cppx::is_in ( const unordered_map< Key, Value > &  map,
const Arg &  v 
) -> Truth

Definition at line 27 of file Map_.hpp.

◆ is_in() [5/9]

template<size_t n>
auto cppx::is_in ( const bitset< n > &  bits,
const int  i 
) -> Truth
inlinenoexcept

Definition at line 37 of file is_in.hpp.

◆ is_in() [6/9]

template<class Key , Size n, class Arg >
auto cppx::is_in ( Raw_array_of_< n, const Key > &  a,
const Arg &  v 
) -> Truth

Definition at line 50 of file is_in.hpp.

◆ is_in() [7/9]

template<class Key , class Arg >
auto cppx::is_in ( const set< Key > &  set,
const Arg &  v 
) -> Truth

Definition at line 57 of file Sorted_set_.hpp.

◆ is_in() [8/9]

template<class Key , class Arg >
auto cppx::is_in ( const unordered_set< Key > &  set,
const Arg &  v 
) -> Truth

Definition at line 57 of file Set_.hpp.

◆ is_in() [9/9]

template<class Integer >
auto cppx::is_in ( const Range_< Integer > &  range,
const Integer  v 
) -> Truth

Definition at line 66 of file Range_.hpp.

◆ is_in_sorted()

template<class Key , Size n, class Arg >
auto cppx::is_in_sorted ( Raw_array_of_< n, const Key > &  a,
const Arg &  v 
) -> Truth

Definition at line 60 of file is_in.hpp.

◆ is_in_sorted_span()

template<class It , class Arg >
auto cppx::is_in_sorted_span ( const It  begin,
const It  end,
const Arg &  v 
) -> Truth

Definition at line 55 of file is_in.hpp.

◆ is_in_span()

template<class It , class Arg >
auto cppx::is_in_span ( const It  begin,
const It  end,
const Arg &  v 
) -> Truth

Definition at line 45 of file is_in.hpp.

◆ is_odd()

template<class Int >
auto cppx::is_odd ( const Int  x) -> Truth
inline

Definition at line 31 of file integer-operations.hpp.

◆ is_of_derived_class_()

template<class Derived , class Type , class = Enable_if_<is_base_and_derived_<Type, Derived>>>
auto cppx::is_of_derived_class_ ( const Type &  o) -> Truth
inline

Definition at line 18 of file is_of_derived_class_.hpp.

◆ it_begin_of()

template<class Collection >
auto cppx::it_begin_of ( Collection &&  c)
inline

Definition at line 23 of file Span_.hpp.

◆ it_end_of()

template<class Collection >
auto cppx::it_end_of ( Collection &&  c)
inline

Definition at line 30 of file Span_.hpp.

◆ joined()

template<class Iterator >
auto cppx::joined ( const Span_< Iterator >  range,
const string &  separator = " " 
) -> string
inline

Definition at line 115 of file string-util.hpp.

◆ left()

auto cppx::left ( const string_view &  s,
const int  width 
) -> string
inline

Definition at line 48 of file string-util.hpp.

◆ length_of() [1/3]

template<class Char >
auto cppx::length_of ( const P_< const Char >  s) -> Size
inlinenoexcept

Definition at line 27 of file dynamic-size-checking.hpp.

◆ length_of() [2/3]

template<class Char >
auto cppx::length_of ( const basic_string< Char > &  s) -> Size
inlinenoexcept

Definition at line 32 of file dynamic-size-checking.hpp.

◆ length_of() [3/3]

template<class Char >
auto cppx::length_of ( const basic_string_view< Char > &  sv) -> Size
inlinenoexcept

Definition at line 37 of file dynamic-size-checking.hpp.

◆ length_of_literal()

template<class Char , Size n>
constexpr auto cppx::length_of_literal ( Raw_array_of_< n, const Char > &  s) -> Size
inlinenoexcept

Definition at line 39 of file fixed-size-checking.hpp.

◆ monospaced_bullet_block()

auto cppx::monospaced_bullet_block ( const string_view &  s,
const string_view &  bullet = best_effort::bullet_str,
const int  indent_size = 4 
) -> string
inline

Definition at line 9 of file monospaced_bullet_block.hpp.

◆ n_items_of() [1/3]

template<class Collection >
constexpr auto cppx::n_items_of ( const Collection &  c) -> Size
noexcept

Definition at line 17 of file dynamic-size-checking.hpp.

◆ n_items_of() [2/3]

template<size_t n>
auto cppx::n_items_of ( const bitset< n > &  bits) -> Size
noexcept

Definition at line 22 of file dynamic-size-checking.hpp.

◆ n_items_of() [3/3]

template<class Iterator >
auto cppx::n_items_of ( const Span_< Iterator > &  range) -> Size
inline

Definition at line 69 of file Span_.hpp.

◆ nan()

constexpr auto cppx::nan ( ) -> double
inline

Definition at line 66 of file named-numbers.hpp.

◆ nan_()

template<class Number >
constexpr auto cppx::nan_ ( ) -> Number

Definition at line 62 of file named-numbers.hpp.

◆ only_lvalue_ref_to()

template<class Type >
auto cppx::only_lvalue_ref_to ( Type &  c) -> Type&
inline

A helper for restricting macro arguments, used e.g. in $items_of.

Definition at line 9 of file only_lvalue_ref_to.hpp.

◆ p_beyond_of()

template<class Char >
auto cppx::p_beyond_of ( const basic_string_view< Char > &  view) -> C_str_<Char>
inlinenoexcept

Definition at line 21 of file pointers-from-string_view.hpp.

◆ p_first_of()

template<class Char >
auto cppx::p_first_of ( const basic_string_view< Char > &  view) -> C_str_<Char>
inlinenoexcept

Definition at line 16 of file pointers-from-string_view.hpp.

◆ quoted() [1/2]

auto cppx::quoted ( const string_view &  sv) -> string
inline

Definition at line 60 of file string-util.hpp.

◆ quoted() [2/2]

auto cppx::quoted ( const char  ch) -> string
inline

Definition at line 70 of file string-util.hpp.

◆ repeat()

template<class Func , class... Args>
void cppx::repeat ( const Size  n,
const Func &  f,
Args &&...  args 
)

Definition at line 11 of file repeat.hpp.

◆ replace_stored_x_with()

auto cppx::replace_stored_x_with ( const exception_ptr &  p) -> exception_ptr
inline

Definition at line 24 of file exception-propagation.hpp.

◆ rethrow_any_stored_x()

void cppx::rethrow_any_stored_x ( )
inline

Definition at line 37 of file exception-propagation.hpp.

◆ reversed() [1/2]

template<class Integer >
void cppx::reversed ( const Range_< Integer > &  )
delete

◆ reversed() [2/2]

template<class Container >
auto cppx::reversed ( Container &&  c) -> Span_<reverse_iterator<decltype( begin( c ) )>>
inline

Definition at line 152 of file Span_.hpp.

◆ right()

auto cppx::right ( const string_view &  s,
const int  width 
) -> string
inline

Definition at line 52 of file string-util.hpp.

◆ set_difference() [1/6]

template<class Key >
auto cppx::set_difference ( const unordered_set< Key > &  a,
const unordered_set< Key > &  b 
) -> Set_<Key>

Definition at line 108 of file Set_.hpp.

◆ set_difference() [2/6]

template<class Key >
auto cppx::set_difference ( const set< Key > &  a,
const set< Key > &  b 
) -> Sorted_set_<Key>

Definition at line 108 of file Sorted_set_.hpp.

◆ set_difference() [3/6]

template<class Key , class Arg >
auto cppx::set_difference ( const unordered_set< Key > &  a,
const Arg &  b 
) -> Set_<Key>

Definition at line 120 of file Set_.hpp.

◆ set_difference() [4/6]

template<class Key , class Arg >
auto cppx::set_difference ( const set< Key > &  a,
const Arg &  b 
) -> Sorted_set_<Key>

Definition at line 120 of file Sorted_set_.hpp.

◆ set_difference() [5/6]

template<class Key >
auto cppx::set_difference ( Sorted_set_< Key > &&  a,
const set< Key > &  b 
) -> Sorted_set_<Key>&&

Definition at line 146 of file Sorted_set_.hpp.

◆ set_difference() [6/6]

template<class Key >
auto cppx::set_difference ( Set_< Key > &&  a,
const unordered_set< Key > &  b 
) -> Set_<Key>&&

Definition at line 146 of file Set_.hpp.

◆ set_intersection() [1/2]

template<class Key >
auto cppx::set_intersection ( const unordered_set< Key > &  a,
const unordered_set< Key > &  b 
) -> Set_<Key>

Definition at line 125 of file Set_.hpp.

◆ set_intersection() [2/2]

template<class Key >
auto cppx::set_intersection ( const set< Key > &  a,
const set< Key > &  b 
) -> Sorted_set_<Key>

Definition at line 125 of file Sorted_set_.hpp.

◆ set_union() [1/6]

template<class Key >
auto cppx::set_union ( const unordered_set< Key > &  a,
const unordered_set< Key > &  b 
) -> Set_<Key>

Definition at line 83 of file Set_.hpp.

◆ set_union() [2/6]

template<class Key >
auto cppx::set_union ( const set< Key > &  a,
const set< Key > &  b 
) -> Sorted_set_<Key>

Definition at line 83 of file Sorted_set_.hpp.

◆ set_union() [3/6]

template<class Key , class Arg >
auto cppx::set_union ( const set< Key > &  a,
const Arg &  b 
) -> Sorted_set_<Key>

Definition at line 98 of file Sorted_set_.hpp.

◆ set_union() [4/6]

template<class Key , class Arg >
auto cppx::set_union ( const unordered_set< Key > &  a,
const Arg &  b 
) -> Set_<Key>

Definition at line 98 of file Set_.hpp.

◆ set_union() [5/6]

template<class Key , class Arg >
auto cppx::set_union ( const Arg &  a,
const set< Key > &  b 
) -> Sorted_set_<Key>

Definition at line 103 of file Sorted_set_.hpp.

◆ set_union() [6/6]

template<class Key , class Arg >
auto cppx::set_union ( const Arg &  a,
const unordered_set< Key > &  b 
) -> Set_<Key>

Definition at line 103 of file Set_.hpp.

◆ spaces()

auto cppx::spaces ( const int  n) -> string
inline

Definition at line 23 of file string-util.hpp.

◆ span_of()

template<class Iterator >
auto cppx::span_of ( const Iterator  first,
const Iterator  beyond 
) -> Span_<Iterator>
inline

Definition at line 74 of file Span_.hpp.

◆ split()

auto cppx::split ( ) -> void
inline

◆ squared()

auto cppx::squared ( const double  x) -> double
inline

The square (second power) of the argument.

Definition at line 57 of file floating-point-operations.hpp.

◆ sum_of_bits() [1/2]

template<int n>
auto cppx::sum_of_bits ( const bitset< n > &  bits) -> int
inlinenoexcept

The number of 1-bits in a std::bitset.

Definition at line 18 of file sum_of_bits.hpp.

◆ sum_of_bits() [2/2]

template<class Unsigned >
auto cppx::sum_of_bits ( const uint16_t  x) -> int
inlinenoexcept

The number of 1-bits in an unsigned value.

Definition at line 24 of file sum_of_bits.hpp.

◆ text_span_of_literal()

template<class Char , Size n>
auto cppx::text_span_of_literal ( const Raw_array_of_< n, const Char > &  string_literal) -> Span_<P_<const Char>>
inline

Definition at line 139 of file Span_.hpp.

◆ to_string()

auto cppx::to_string ( const Abstract_source_location loc) -> string
inline

Definition at line 79 of file Abstract_source_location.hpp.

◆ trimmed() [1/3]

auto cppx::trimmed ( const string_view &  sv) -> string_view
inline

Definition at line 74 of file string-util.hpp.

◆ trimmed() [2/3]

auto cppx::trimmed ( const string &  s) -> string
inline

Definition at line 94 of file string-util.hpp.

◆ trimmed() [3/3]

auto cppx::trimmed ( string &&  s) -> string
inline

Definition at line 98 of file string-util.hpp.

◆ up_to()

template<class Integer = int>
constexpr auto cppx::up_to ( const Integer  n) -> Range_<Integer>
inlinenoexcept

Definition at line 61 of file Range_.hpp.

Variable Documentation

◆ bits_per_

template<class Type >
constexpr int cppx::bits_per_ = sizeof( Type )*bits_per_byte

The number of bits per object/value of the specified type.

Definition at line 22 of file bits_per_.hpp.

◆ bits_per_byte

const int cppx::bits_per_byte = CHAR_BIT

Usually 8, but e.g. 16 on some DSPs.

Definition at line 18 of file bits_per_.hpp.

◆ check_the_execution_character_set

constexpr Truth cppx::check_the_execution_character_set = true

Definition at line 9 of file config.hpp.

◆ contains_type_

template<class Some_type , class Type_list >
constexpr bool cppx::contains_type_
Initial value:
=
impl::Contains_<Some_type, Type_list>::value

Definition at line 88 of file Type_list_.hpp.

◆ contains_type_subset_

template<class Possible_subset , class Main_set >
constexpr bool cppx::contains_type_subset_
Initial value:
=
impl::Has_subset_<Possible_subset, Main_set>::value

Definition at line 92 of file Type_list_.hpp.

◆ e

const auto cppx::e = 2.71828182845904523536

Definition at line 42 of file named-numbers.hpp.

◆ empty_c_string

template<class Char >
constexpr Raw_array_of_<1, const Char> cppx::empty_c_string = {}

Definition at line 13 of file pointers-from-string_view.hpp.

◆ epsilon_

template<class T >
constexpr T cppx::epsilon_

The difference between 1 and the least floating point value greater than 1.

The expression epsilon_<T> is an alias for std::numeric_limits<T>::epsilon().

Definition at line 157 of file number-type-properties.hpp.

◆ has_infinity

constexpr Truth cppx::has_infinity = has_infinity_<double>

Definition at line 73 of file named-numbers.hpp.

◆ has_infinity_

template<class Number = double>
constexpr Truth cppx::has_infinity_ = numeric_limits<double>::has_infinity

Definition at line 71 of file named-numbers.hpp.

◆ has_method_empty_

template<class Collection >
constexpr Truth cppx::has_method_empty_ = Has_method_empty_<Collection>::value

Definition at line 30 of file is_empty.hpp.

◆ has_nan

constexpr Truth cppx::has_nan = has_nan_<double>

Definition at line 59 of file named-numbers.hpp.

◆ has_nan_

template<class Number = double>
constexpr Truth cppx::has_nan_ = numeric_limits<Number>::has_quiet_NaN

Definition at line 57 of file named-numbers.hpp.

◆ inv_sqrt2

const auto cppx::inv_sqrt2 = 0.707106781186547524401

Definition at line 54 of file named-numbers.hpp.

◆ inv_sqrt_pi

const auto cppx::inv_sqrt_pi = 1.12837916709551257390

Definition at line 52 of file named-numbers.hpp.

◆ is_a_

template<class T , class U >
constexpr Truth cppx::is_a_ = is_same_type_<T, U> or is_base_and_derived_<T, U>

Definition at line 37 of file basic-type-traits.hpp.

◆ is_a_byte_char_type_

template<class Char >
constexpr Truth cppx::is_a_byte_char_type_ = contains_type_<Char, Byte_char_types>

Definition at line 45 of file type-traits.hpp.

◆ is_a_char_type_

template<class Char >
constexpr Truth cppx::is_a_char_type_ = is_a_cpp11_char_type_<Char>

Definition at line 39 of file type-traits.hpp.

◆ is_a_char_variant_type_

template<class Char >
constexpr Truth cppx::is_a_char_variant_type_ = contains_type_<Char, Char_variant_types>

Definition at line 42 of file type-traits.hpp.

◆ is_a_cpp03_char_type_

template<class Char >
constexpr Truth cppx::is_a_cpp03_char_type_ = contains_type_<Char, Cpp03_char_literal_types>

Definition at line 33 of file type-traits.hpp.

◆ is_a_cpp11_char_type_

template<class Char >
constexpr Truth cppx::is_a_cpp11_char_type_ = contains_type_<Char, Cpp11_char_literal_types>

Definition at line 36 of file type-traits.hpp.

◆ is_base_and_derived_

template<class Base , class Derived >
constexpr Truth cppx::is_base_and_derived_ = std::is_base_of_v<Base, Derived>

Definition at line 31 of file basic-type-traits.hpp.

◆ is_class_

template<class T >
constexpr Truth cppx::is_class_ = std::is_class_v<T>

Definition at line 45 of file basic-type-traits.hpp.

◆ is_const_

template<class T >
constexpr Truth cppx::is_const_ = std::is_const_v<std::remove_reference_t<T>>

Definition at line 42 of file basic-type-traits.hpp.

◆ is_fixed_point_

template<class T >
constexpr Truth cppx::is_fixed_point_ = false

Definition at line 48 of file basic-type-traits.hpp.

◆ is_floating_point_

template<class T >
constexpr Truth cppx::is_floating_point_ = std::is_floating_point_v<T>

Definition at line 51 of file basic-type-traits.hpp.

◆ is_ieee_754_

template<class T >
constexpr Truth cppx::is_ieee_754_

FP only. Whether the implementation claims to conform to the IEEE 754 standard.

is_ieee_754_<T> is an alias for std::numeric_limits<T>::is_iec559.

IEC 559 is just the European name of the IEEE 754 floating point standard.

Note that (at the writing of this documentation) both the Visual C++ and g++ compilers report IEEE 754 conformance when their fast-math options are used, which in particular causes incorrect NaN-checking, i.e. non-conformance.

Definition at line 91 of file number-type-properties.hpp.

◆ is_integral_

template<class T >
constexpr Truth cppx::is_integral_ = std::is_integral_v<T>

Definition at line 54 of file basic-type-traits.hpp.

◆ is_same_type_

template<class T , class U >
constexpr Truth cppx::is_same_type_ = std::is_same_v<T, U>

Definition at line 34 of file basic-type-traits.hpp.

◆ is_signed_

template<class Int >
constexpr Truth cppx::is_signed_ = std::is_signed_v<Int>

Definition at line 57 of file basic-type-traits.hpp.

◆ is_unsigned_

template<class Int >
constexpr Truth cppx::is_unsigned_ = std::is_unsigned_v<Int>

Definition at line 60 of file basic-type-traits.hpp.

◆ largest_

template<class T >
constexpr T cppx::largest_

The largest representable-as-positive absolute value of the type.

largest_<T> is an alias for std::numeric_limits<T>::max().

Definition at line 97 of file number-type-properties.hpp.

◆ ln10

const auto cppx::ln10 = 2.30258509299404568402

Definition at line 46 of file named-numbers.hpp.

◆ ln2

const auto cppx::ln2 = 0.693147180559945309417

Definition at line 45 of file named-numbers.hpp.

◆ log10e

const auto cppx::log10e = 0.434294481903251827651

Definition at line 44 of file named-numbers.hpp.

◆ log2e

const auto cppx::log2e = 1.44269504088896340736

Definition at line 43 of file named-numbers.hpp.

◆ magnitude_bits_per_

template<class Type >
constexpr int cppx::magnitude_bits_per_ = numeric_limits<Type>::digits

The number of bits that determine the magnitude, i.e. the number of value representation bits minus a sign bit, if any.

On 2019 computers this is generally bits_per_<Type> - std::is_signed_v<Type>.

Definition at line 30 of file bits_per_.hpp.

◆ max_

template<class T >
constexpr T cppx::max_

The largest positive value of the type.

The expression max_<T> is an alias for largest_<T>.

Definition at line 110 of file number-type-properties.hpp.

◆ max_e_

template<class T >
constexpr int cppx::max_e_

FP only. E-notation maximum (largest positive) exponent value.

The expression max_e_<T> is an alias for std::numeric_limits<T>::max_exponent10.

Definition at line 126 of file number-type-properties.hpp.

◆ min_

template<class T >
constexpr T cppx::min_

The largest negative value of the type.

For integer T the expression min_<T> is an alias for std::numeric_limits<T>::min(), which is usually/always -largest_<T> - 1.

For floating point T the expression min_<T> is an alias for -largest_<T>.

Definition at line 119 of file number-type-properties.hpp.

◆ min_e_

template<class T >
constexpr int cppx::min_e_

FP only. E-notation minimum (largest negative) exponent value.

The expression min_e_<T> is an alias for std::numeric_limits<T>::min_exponent10.

Definition at line 133 of file number-type-properties.hpp.

◆ n_digits_

template<class T >
constexpr int cppx::n_digits_

Number of decimal digits that guaranteed can be represented.

The expression n_digits_<T> is an alias for std::numeric_limits<T>::digits10.

Definition at line 139 of file number-type-properties.hpp.

◆ pi

const auto cppx::pi = 3.14159265358979323846

Definition at line 47 of file named-numbers.hpp.

◆ radix_

template<class T >
constexpr int cppx::radix_

FP only. The numeral system base of the floating point representation, 2 or 10.

The C++ standard requires integer types to be represented in binary, as either two's complement (now universal), ones' complement or sign and magnitude. From C++20 it will require two's complement form. However, it allows a floating point type to use a representation in some other numeral system such as 10, decimal.

The expression radix_<T> is an alias for std::numeric_limits<T>::radix.

Definition at line 151 of file number-type-properties.hpp.

◆ smallest_

template<class T >
constexpr T cppx::smallest_

The smallest non-zero absolute value of the type.

For integer T this is just 1, and for floating point T the expression smallest_<T> is an alias for std::numeric_limits<T>::min().

Definition at line 104 of file number-type-properties.hpp.

◆ sqrt2

const auto cppx::sqrt2 = 1.41421356237309504880

Definition at line 53 of file named-numbers.hpp.

◆ std_ascii_bad_char

const char cppx::std_ascii_bad_char = ascii::end_of_text

Definition at line 64 of file ascii-character-names.hpp.

◆ std_unicode_bad_char

const wchar_t cppx::std_unicode_bad_char = L'\uFFFD'

Definition at line 65 of file ascii-character-names.hpp.

◆ use_ascii_substitutes

constexpr Truth cppx::use_ascii_substitutes = false

Definition at line 19 of file config.hpp.