Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/utility"

From cppreference.com
< cpp
(top link to /cpp/utility/format)
m
 
(47 intermediate revisions by 14 users not shown)
Line 2: Line 2:
 
{{cpp/utility/navbar}}
 
{{cpp/utility/navbar}}
  
C++ includes a variety of utility libraries that provide functionality ranging from [[cpp/utility/bitset|bit-counting]] to [[cpp/utility/functional/bind|partial function application]]. These libraries can be broadly divided into two groups:  
+
C++ includes a variety of utility libraries that provide functionality ranging from [[cpp/utility/bitset|bit-counting]] to [[cpp/utility/functional/bind|partial function application]]. These libraries can be broadly divided into two groups:
  
 
* language support libraries, and
 
* language support libraries, and
Line 8: Line 8:
  
 
==Language support==
 
==Language support==
 
 
Language support libraries provide classes and functions that interact closely with language features and support common language idioms.
 
Language support libraries provide classes and functions that interact closely with language features and support common language idioms.
  
 
===[[cpp/types|Type support]]===
 
===[[cpp/types|Type support]]===
 +
Basic types (e.g. {{lc|std::size_t}}, {{lc|std::nullptr_t}}), RTTI (e.g. {{lc|std::type_info}})
  
Basic types (e.g. {{lc|std::size_t}}, {{lc|std::nullptr_t}}), RTTI (e.g. {{lc|std::type_info}}), type traits (e.g. {{lc|std::is_integral}}, {{lc|std::rank}})
+
===[[cpp/meta|Metaprogramming]]===
 +
Type traits (e.g. {{lc|std::is_integral}}, {{lc|std::rank}}), compile-time constants (e.g. {{lc|std::integer_sequence}}, {{lc|std::ratio}})
  
===[[cpp/memory|Dynamic memory management]]===
+
===Constant evaluation context===
 +
{{dsc begin}}
 +
{{dsc header|type_traits}}
 +
{{dsc inc|cpp/types/dsc is_constant_evaluated}}
 +
{{dsc inc|cpp/types/dsc is_within_lifetime}}
 +
{{dsc end}}
  
Smart pointers (e.g. {{lc|std::shared_ptr}}), allocators (e.g. {{lc|std::allocator}} or {{lc|std::memory_resource}}), C-style memory management (e.g. {{lc|std::malloc}})
+
===[[cpp/utility/feature_test|Implementation properties]]===
 +
{{rrev|since=c++20|
 +
The header {{header|version}} supplies implementation-dependent information about the C++ standard library (such as the version number and release date). It also defines the [[cpp/utility/feature test|library feature-test macros]].
 +
}}
 +
 
 +
===[[cpp/utility/program|Program utilities]]===
 +
Termination (e.g. {{lc|std::abort}}, {{lc|std::atexit}}), environment (e.g. {{lc|std::system}}), signals (e.g. {{lc|std::raise}})
 +
 
 +
===[[cpp/memory|Dynamic memory management]]===
 +
Smart pointers (e.g. {{lc|std::shared_ptr}}), allocators (e.g. {{lc|std::allocator}} or {{lc|std::pmr::memory_resource}}), C-style memory management (e.g. {{lc|std::malloc}})
  
 
===[[cpp/error|Error handling]]===
 
===[[cpp/error|Error handling]]===
 
Exceptions (e.g. {{lc|std::exception}}, {{lc|std::terminate}}), assertions (e.g. {{lc|assert}})
 
Exceptions (e.g. {{lc|std::exception}}, {{lc|std::terminate}}), assertions (e.g. {{lc|assert}})
  
===Initializer lists===
+
===[[cpp/utility/source_location|Source code information capture]]===
 +
{{dsc begin}}
 +
{{dsc header|source_location}}
 +
{{dsc inc|cpp/utility/dsc source_location}}
 +
{{dsc end}}
  
 +
===[[cpp/utility/initializer_list|Initializer lists]]===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc header | initializer_list}}
+
{{dsc header|initializer_list}}
{{dsc inc | cpp/utility/dsc initializer_list}}
+
{{dsc inc|cpp/utility/dsc initializer_list}}
 
{{dsc end}}
 
{{dsc end}}
  
===[[cpp/utility/variadic|Variadic functions]]===
+
===Three-way comparison===
 +
{{dsc begin}}
 +
{{dsc header|compare}}
 +
{{dsc inc|cpp/utility/compare/dsc three_way_comparable}}
 +
{{dsc inc|cpp/utility/compare/dsc partial_ordering}}
 +
{{dsc inc|cpp/utility/compare/dsc weak_ordering}}
 +
{{dsc inc|cpp/utility/compare/dsc strong_ordering}}
 +
{{dsc inc|cpp/utility/compare/dsc named_comparison_functions}}
 +
{{dsc inc|cpp/utility/compare/dsc compare_three_way}}
 +
{{dsc inc|cpp/utility/compare/dsc compare_three_way_result}}
 +
{{dsc inc|cpp/utility/compare/dsc common_comparison_category}}
 +
{{dsc inc|cpp/utility/compare/dsc strong_order}}
 +
{{dsc inc|cpp/utility/compare/dsc weak_order}}
 +
{{dsc inc|cpp/utility/compare/dsc partial_order}}
 +
{{dsc inc|cpp/utility/compare/dsc compare_strong_order_fallback}}
 +
{{dsc inc|cpp/utility/compare/dsc compare_weak_order_fallback}}
 +
{{dsc inc|cpp/utility/compare/dsc compare_partial_order_fallback}}
 +
{{dsc end}}
  
Support for functions that take an arbitrary number of parameters (via e.g. {{lc|va_start}}, {{lc|va_arg}}, {{lc|va_end}})
+
===[[cpp/coroutine|Coroutine support]]===
 +
{{rrev|since=c++20|
 +
Types for coroutine support, e.g. {{lc|std::coroutine_traits}}, {{lc|std::coroutine_handle}}.
 +
}}
  
{{rrev | since=c++20 |1=
+
===[[cpp/utility/variadic|Variadic functions]]===
===Implementation properties ===
+
Support for functions that take an arbitrary number of parameters (via e.g. {{lc|va_start}}, {{lc|va_arg}}, {{lc|va_end}}).
The header {{header|version}} supplies implementation-dependent information about the C++ standard library (such as the version number and release date. It also defines the [[cpp/utility/feature_test|library feature-test macros]].
+
  
===Source code information capture===
+
==General-purpose utilities==
 +
===Swap===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc header | source_location}}
+
{{dsc header|utility}}
{{dsc inc | cpp/utility/dsc source_location}}
+
{{dsc inc|cpp/algorithm/dsc swap}}
 +
{{dsc inc|cpp/utility/dsc exchange}}
 +
{{dsc header|concepts}}
 +
{{dsc inc|cpp/utility/ranges/dsc swap}}
 
{{dsc end}}
 
{{dsc end}}
}}
 
  
==General-purpose utilities==
+
===Type operations===
 +
{{dsc begin}}
 +
{{dsc header|utility}}
 +
{{dsc inc|cpp/utility/dsc forward}}
 +
{{dsc inc|cpp/utility/dsc forward_like}}
 +
{{dsc inc|cpp/utility/dsc move}}
 +
{{dsc inc|cpp/utility/dsc move_if_noexcept}}
 +
{{dsc inc|cpp/utility/dsc as_const}}
 +
{{dsc inc|cpp/utility/dsc declval}}
 +
{{dsc inc|cpp/utility/dsc to_underlying}}
 +
{{dsc end}}
  
===[[cpp/utility/program | Program utilities]]===
+
===Integer comparison functions===
 +
{{dsc begin}}
 +
{{dsc header|utility}}
 +
{{dsc inc|cpp/utility/dsc intcmp}}
 +
{{dsc inc|cpp/utility/dsc in_range}}
 +
{{dsc end}}
  
Termination (e.g. {{lc|std::abort}}, {{lc|std::atexit}}), environment (e.g. {{lc|std::system}}), signals (e.g. {{lc|std::raise}})
+
===Relational operators===
 +
{{dsc begin}}
 +
{{dsc header|utility}}
 +
{{dsc namespace|std::rel_ops}}
 +
{{dsc inc|cpp/utility/rel_ops/dsc operator_cmp}}
 +
{{dsc end}}
  
===[[cpp/chrono|Date and time]]===
+
===Construction tags===
 
+
{{dsc begin}}
Time tracking (e.g. {{lc|std::chrono::time_point}}, {{lc|std::chrono::duration}}), C-style date and time (e.g. {{lc|std::time}}, {{lc|std::clock}})
+
{{dsc header|utility}}
 
+
{{dsc inc|cpp/utility/dsc piecewise_construct}}
===Bitset===
+
{{dsc inc|cpp/utility/dsc in_place}}
 +
{{dsc inc|cpp/utility/dsc nontype}}
 +
{{dsc end}}
  
 +
===[[cpp/utility/pair|Pairs]] and [[cpp/utility/tuple|tuples]]===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc header | bitset}}
+
{{dsc header|utility}}
{{dsc inc | cpp/utility/dsc bitset}}
+
{{dsc inc|cpp/utility/dsc pair}}
 +
{{dsc header|tuple}}
 +
{{dsc inc|cpp/utility/dsc tuple}}
 +
{{dsc inc|cpp/utility/dsc apply}}
 +
{{dsc inc|cpp/utility/dsc make_from_tuple}}
 +
{{dsc h2|[[cpp/utility/tuple/tuple-like|Tuple protocol]]}}
 +
{{dsc header|tuple}}
 +
{{dsc header|utility}}
 +
{{dsc header|array}}
 +
{{dsc header|ranges}}
 +
{{dsc header|complex}}
 +
{{dsc inc|cpp/utility/dsc tuple_size}}
 +
{{dsc inc|cpp/utility/dsc tuple_element}}
 
{{dsc end}}
 
{{dsc end}}
  
===[[cpp/utility/functional|Function objects]]===
+
===Sum types and type erased wrappers===
 
+
Partial function application (e.g. {{lc|std::bind}}) and related utilities: utilities for binding such as {{lc|std::ref}}  and {{lc|std::placeholders}}, polymorphic function wrappers: {{lc|std::function}}, predefined functors (e.g. {{lc|std::plus}}, {{lc|std::equal_to}}), method to function converters {{lc|std::mem_fn}}.
+
 
+
===Optional, variant and any===
+
 
{{dsc begin}}
 
{{dsc begin}}
 
{{dsc header|optional}}
 
{{dsc header|optional}}
{{dsc inc | cpp/utility/dsc optional}}
+
{{dsc inc|cpp/utility/dsc optional}}
 +
{{dsc sep}}
 +
{{dsc header|expected}}
 +
{{dsc inc|cpp/utility/dsc expected}}
 
{{dsc sep}}
 
{{dsc sep}}
 
{{dsc header|variant}}
 
{{dsc header|variant}}
{{dsc inc | cpp/utility/dsc variant}}
+
{{dsc inc|cpp/utility/dsc variant}}
 
{{dsc sep}}
 
{{dsc sep}}
 
{{dsc header|any}}
 
{{dsc header|any}}
{{dsc inc | cpp/utility/dsc any}}
+
{{dsc inc|cpp/utility/dsc any}}
{{dsc sep}}
+
{{dsc header|utility}}
+
{{dsc inc | cpp/utility/dsc in_place}}
+
 
{{dsc end}}
 
{{dsc end}}
  
===Pairs and tuples===
+
===[[cpp/utility/bitset|Bitset]]===
 
+
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/utility/dsc pair}}
+
{{dsc header|bitset}}
{{dsc inc | cpp/utility/dsc tuple}}
+
{{dsc inc|cpp/utility/dsc bitset}}
{{dsc inc | cpp/utility/dsc apply}}
+
{{dsc inc | cpp/utility/dsc make_from_tuple}}
+
{{dsc inc | cpp/utility/dsc piecewise_construct_t}}
+
{{dsc inc | cpp/utility/dsc piecewise_construct}}
+
{{dsc inc | cpp/utility/dsc integer_sequence}}
+
 
{{dsc end}}
 
{{dsc end}}
  
===Swap, forward and move===
+
===[[cpp/utility/functional|Function objects]]===
 +
Partial function application (e.g. {{lc|std::bind}}) and related utilities: utilities for binding such as {{lc|std::ref}}  and {{lc|std::placeholders}}, polymorphic function wrappers: {{lc|std::function}}, predefined functors (e.g. {{lc|std::plus}}, {{lc|std::equal_to}}), pointer-to-member to function converters {{lc|std::mem_fn}}.
  
 +
===[[cpp/utility/hash|Hash support]]===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc header | utility }}
+
{{dsc header|functional}}
{{dsc inc | cpp/algorithm/dsc swap}}
+
{{dsc inc|cpp/utility/dsc hash}}
{{dsc inc | cpp/utility/dsc exchange}}
+
{{dsc inc | cpp/utility/dsc forward}}
+
{{dsc inc | cpp/utility/dsc move}}
+
{{dsc inc | cpp/utility/dsc move_if_noexcept}}
+
{{dsc header | concepts }}
+
{{dsc inc | cpp/utility/ranges/dsc swap}}
+
 
{{dsc end}}
 
{{dsc end}}
  
===Type operations===
+
===[[cpp/chrono|Date and time]]===
{{dsc begin}}
+
Time tracking (e.g. {{lc|std::chrono::time_point}}, {{lc|std::chrono::duration}}), C-style date and time (e.g. {{lc|std::time}}, {{lc|std::clock}})
{{dsc header|utility}}
+
{{dsc inc | cpp/utility/dsc declval}}
+
{{dsc inc | cpp/utility/dsc as_const}}
+
{{dsc sep}}
+
{{dsc header|new}}
+
{{dsc inc | cpp/utility/dsc launder}}
+
{{dsc end}}
+
 
+
===Relational operators and comparison===
+
  
 +
===Primitive string conversions===
 +
In addition to sophisticated locale-dependent parsers and formatters provided by the [[cpp/io|C++ I/O]] library, the [[cpp/io/c|C I/O]] library, [[cpp/string/basic_string#Numeric conversions|C++ string converters]], and [[cpp/string/byte#Conversions to numeric formats|C string converters]], the header {{header|charconv}} provides light-weight, locale-independent, non-allocating, non-throwing parsers and formatters for arithmetic types.
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc header|compare}}
+
{{dsc header|charconv}}
{{dsc inc | cpp/utility/compare/dsc weak_equality}}
+
{{dsc inc|cpp/utility/dsc to_chars}}
{{dsc inc | cpp/utility/compare/dsc strong_equality}}
+
{{dsc inc|cpp/utility/dsc to_chars_result}}
{{dsc inc | cpp/utility/compare/dsc partial_ordering}}
+
{{dsc inc|cpp/utility/dsc from_chars}}
{{dsc inc | cpp/utility/compare/dsc weak_ordering}}
+
{{dsc inc|cpp/utility/dsc from_chars_result}}
{{dsc inc | cpp/utility/compare/dsc strong_ordering}}
+
{{dsc inc|cpp/utility/dsc chars_format}}
{{dsc inc | cpp/utility/compare/dsc named_comparison_functions}}
+
{{dsc inc | cpp/utility/compare/dsc common_comparison_category}}
+
{{dsc inc | cpp/utility/compare/dsc strong_order}}
+
{{dsc inc | cpp/utility/compare/dsc weak_order}}
+
{{dsc inc | cpp/utility/compare/dsc partial_order}}
+
{{dsc inc | cpp/utility/compare/dsc strong_equal}}
+
{{dsc inc | cpp/utility/compare/dsc weak_equal}}
+
{{dsc sep}}
+
{{dsc header|utility}}
+
{{dsc namespace | std::rel_ops }}
+
{{dsc inc | cpp/utility/rel_ops/dsc operator_cmp}}
+
 
{{dsc end}}
 
{{dsc end}}
  
===Elementary string conversions===
+
===[[cpp/utility/format|Formatting library]]===
In addition to sophisticated locale-dependent parsers and formatters provided by the [[cpp/io|C++ I/O]] library, the [[cpp/io/c|C I/O]] library, [[cpp/string/basic_string#Numeric_conversions|C++ string converters]], and [[cpp/string/byte#Conversions_to_numeric_formats|C string converters]], the header {{header|charconv}} provides light-weight, locale-independent, non-allocating, non-throwing, ASCII-only parsers and formatters for arithmetic types.
+
Facilities for type-safe string formatting.
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc header|charconv}}
+
{{dsc header|format}}
{{dsc inc | cpp/utility/dsc to_chars}} <!-- including to_chars_result  -->
+
{{dsc inc|cpp/utility/format/dsc format}}
{{dsc inc | cpp/utility/dsc from_chars}} <!-- including from_chars_result -->
+
{{dsc inc|cpp/utility/format/dsc format_to}}
{{dsc inc | cpp/utility/dsc chars_format}}
+
{{dsc inc|cpp/utility/format/dsc format_to_n}}
 +
{{dsc inc|cpp/utility/format/dsc formatted_size}}
 +
{{dsc inc|cpp/utility/format/dsc vformat}}
 +
{{dsc inc|cpp/utility/format/dsc vformat_to}}
 +
{{dsc inc|cpp/utility/format/dsc formatter}}
 +
{{dsc inc|cpp/utility/format/dsc format_error}}
 
{{dsc end}}
 
{{dsc end}}
  
===[[cpp/utility/format|Formatting library]] {{mark since c++20}}===
+
===See also===
Facilities for type-safe string formatting, e.g. {{lc|std::format}} {{lc|std::format_to}}.
+
 
+
===Hash support===
+
 
+
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/utility/dsc hash}}
+
{{dsc see c|c/utility|Utility library|nomono=true}}
 
{{dsc end}}
 
{{dsc end}}
  
{{langlinks|ar|cs|de|es|fr|it|ja|ko|pl|pt|ru|zh}}
+
{{langlinks|ar|cs|de|es|fr|it|ja|ko|pl|pt|ru|tr|zh}}

Latest revision as of 01:42, 14 November 2024

 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 

C++ includes a variety of utility libraries that provide functionality ranging from bit-counting to partial function application. These libraries can be broadly divided into two groups:

  • language support libraries, and
  • general-purpose libraries.

Contents

[edit] Language support

Language support libraries provide classes and functions that interact closely with language features and support common language idioms.

[edit] Type support

Basic types (e.g. std::size_t, std::nullptr_t), RTTI (e.g. std::type_info)

[edit] Metaprogramming

Type traits (e.g. std::is_integral, std::rank), compile-time constants (e.g. std::integer_sequence, std::ratio)

[edit] Constant evaluation context

Defined in header <type_traits>
detects whether the call occurs within a constant-evaluated context
(function) [edit]
checks whether a pointer is within the object's lifetime at compile time
(function) [edit]

[edit] Implementation properties

The header <version> supplies implementation-dependent information about the C++ standard library (such as the version number and release date). It also defines the library feature-test macros.

(since C++20)

[edit] Program utilities

Termination (e.g. std::abort, std::atexit), environment (e.g. std::system), signals (e.g. std::raise)

[edit] Dynamic memory management

Smart pointers (e.g. std::shared_ptr), allocators (e.g. std::allocator or std::pmr::memory_resource), C-style memory management (e.g. std::malloc)

[edit] Error handling

Exceptions (e.g. std::exception, std::terminate), assertions (e.g. assert)

[edit] Source code information capture

Defined in header <source_location>
a class representing information about the source code, such as file names, line numbers, and function names
(class) [edit]

[edit] Initializer lists

Defined in header <initializer_list>
references a temporary array created in list-initialization
(class template) [edit]

[edit] Three-way comparison

Defined in header <compare>
specifies that operator <=> produces consistent result on given types
(concept) [edit]
the result type of 3-way comparison that supports all 6 operators, is not substitutable, and allows incomparable values
(class) [edit]
the result type of 3-way comparison that supports all 6 operators and is not substitutable
(class) [edit]
the result type of 3-way comparison that supports all 6 operators and is substitutable
(class) [edit]
named comparison functions
(function) [edit]
constrained function object implementing x <=> y
(class) [edit]
obtains the result type of the three-way comparison operator <=> on given types
(class template) [edit]
the strongest comparison category to which all of the given types can be converted
(class template) [edit]
performs 3-way comparison and produces a result of type std::strong_ordering
(customization point object)[edit]
performs 3-way comparison and produces a result of type std::weak_ordering
(customization point object)[edit]
performs 3-way comparison and produces a result of type std::partial_ordering
(customization point object)[edit]
performs 3-way comparison and produces a result of type std::strong_ordering, even if operator<=> is unavailable
(customization point object)[edit]
performs 3-way comparison and produces a result of type std::weak_ordering, even if operator<=> is unavailable
(customization point object)[edit]
performs 3-way comparison and produces a result of type std::partial_ordering, even if operator<=> is unavailable
(customization point object)[edit]

[edit] Coroutine support

Types for coroutine support, e.g. std::coroutine_traits, std::coroutine_handle.

(since C++20)

[edit] Variadic functions

Support for functions that take an arbitrary number of parameters (via e.g. va_start, va_arg, va_end).

[edit] General-purpose utilities

[edit] Swap

Defined in header <utility>
swaps the values of two objects
(function template) [edit]
(C++14)
replaces the argument with a new value and returns its previous value
(function template) [edit]
Defined in header <concepts>
swaps the values of two objects
(customization point object)[edit]

[edit] Type operations

Defined in header <utility>
(C++11)
forwards a function argument and use the type template argument to preserve its value category
(function template) [edit]
forwards a function argument as if casting it to the value category and constness of the expression of specified type template argument
(function template) [edit]
(C++11)
converts the argument to an xvalue
(function template) [edit]
converts the argument to an xvalue if the move constructor does not throw
(function template) [edit]
(C++17)
obtains a reference to const to its argument
(function template) [edit]
(C++11)
obtains a reference to an object of the template type argument for use in an unevaluated context
(function template) [edit]
converts an enumeration to its underlying type
(function template) [edit]

[edit] Integer comparison functions

Defined in header <utility>
compares two integer values, ensuring that signed negative numbers are less than unsigned numbers
(function template) [edit]
(C++20)
checks if an integer value is in the range of a given integer type
(function template) [edit]

[edit] Relational operators

Defined in header <utility>
Defined in namespace std::rel_ops
automatically generates comparison operators based on user-defined operator== and operator<
(function template) [edit]

[edit] Construction tags

Defined in header <utility>
piecewise construction tag
(tag)[edit]
in-place construction tag
(tag)[edit]
value construction tag
(tag)[edit]

[edit] Pairs and tuples

Defined in header <utility>
implements binary tuple, i.e. a pair of values
(class template) [edit]
Defined in header <tuple>
(C++11)
implements fixed size container, which holds elements of possibly different types
(class template) [edit]
(C++17)
calls a function with a tuple of arguments
(function template) [edit]
construct an object with a tuple of arguments
(function template) [edit]
Tuple protocol
Defined in header <tuple>
Defined in header <utility>
Defined in header <array>
Defined in header <ranges>
Defined in header <complex>
obtains the number of elements of a tuple-like type
(class template) [edit]
obtains the element types of a tuple-like type
(class template) [edit]

[edit] Sum types and type erased wrappers

Defined in header <optional>
(C++17)
a wrapper that may or may not hold an object
(class template) [edit]
 
Defined in header <expected>
(C++23)
a wrapper that contains either an expected or error value
(class template) [edit]
 
Defined in header <variant>
(C++17)
a type-safe discriminated union
(class template) [edit]
 
Defined in header <any>
(C++17)
objects that hold instances of any CopyConstructible type
(class) [edit]

[edit] Bitset

Defined in header <bitset>
implements constant length bit array
(class template) [edit]

[edit] Function objects

Partial function application (e.g. std::bind) and related utilities: utilities for binding such as std::ref and std::placeholders, polymorphic function wrappers: std::function, predefined functors (e.g. std::plus, std::equal_to), pointer-to-member to function converters std::mem_fn.

[edit] Hash support

Defined in header <functional>
(C++11)
hash function object
(class template) [edit]

[edit] Date and time

Time tracking (e.g. std::chrono::time_point, std::chrono::duration), C-style date and time (e.g. std::time, std::clock)

[edit] Primitive string conversions

In addition to sophisticated locale-dependent parsers and formatters provided by the C++ I/O library, the C I/O library, C++ string converters, and C string converters, the header <charconv> provides light-weight, locale-independent, non-allocating, non-throwing parsers and formatters for arithmetic types.

Defined in header <charconv>
(C++17)
converts an integer or floating-point value to a character sequence
(function) [edit]
the return type of std::to_chars
(class) [edit]
converts a character sequence to an integer or floating-point value
(function) [edit]
the return type of std::from_chars
(class) [edit]
specifies formatting for std::to_chars and std::from_chars
(enum) [edit]

[edit] Formatting library

Facilities for type-safe string formatting.

Defined in header <format>
(C++20)
stores formatted representation of the arguments in a new string
(function template) [edit]
(C++20)
writes out formatted representation of its arguments through an output iterator
(function template) [edit]
writes out formatted representation of its arguments through an output iterator, not exceeding specified size
(function template) [edit]
determines the number of characters necessary to store the formatted representation of its arguments
(function template) [edit]
(C++20)
non-template variant of std::format using type-erased argument representation
(function) [edit]
non-template variant of std::format_to using type-erased argument representation
(function template) [edit]
(C++20)
defines formatting rules for a given type
(class template) [edit]
exception type thrown on formatting errors
(class) [edit]

[edit] See also

C documentation for Utility library