<utility>
Defines C++ Standard Library types, functions, and operators that help to construct and manage pairs of objects, which are useful whenever two objects should be treated as if they were one.
Requirements
Header: <utility>
Namespace: std
Remarks
Pairs are widely used in the C++ Standard Library. They're required both as the arguments and return values for various functions and as element types for associative containers like map
and multimap
.
Members
Classes
Type | Description |
---|---|
chars_format |
Floating-point format for primitive numerical conversion. |
tuple_element |
Wraps the type of a pair element. |
tuple_size |
Wraps a pair element count. |
Objects
Template | Description |
---|---|
index_sequence |
An alias template defined for the common case where T is std::size_t |
index_sequence_for |
Helper alias template to convert any type parameter pack into an index sequence of the same length |
make_index_sequence |
Helper alias template to simplify the creation of a std::index_sequence type. |
make_integer_sequence |
Helper alias template to simplify the creation of a std::integer_sequence type. |
Functions
Function | Description |
---|---|
as_const |
Returns type. |
declval |
Shorthand expression evaluation. |
exchange |
Assigns a new value to an object and returns its old value. |
forward |
Preserves the reference type (either lvalue or rvalue ) of the argument from being obscured by perfect forwarding. |
from_chars |
|
get |
A function that gets an element from a pair object. |
make_pair |
A template helper function used to construct objects of type pair , where the component types are based on the data types passed as parameters. |
move |
Returns the passed in argument as an rvalue reference. |
move_if_noexcept |
|
swap |
Exchanges the elements of two pair objects. |
to_chars |
Converts value into a character string. |
Operators
Operator | Description |
---|---|
operator!= |
Tests if the pair object on the left side of the operator isn't equal to the pair object on the right side. |
operator== |
Tests if the pair object on the left side of the operator is equal to the pair object on the right side. |
operator< |
Tests if the pair object on the left side of the operator is less than the pair object on the right side. |
operator<= |
Tests if the pair object on the left side of the operator is less than or equal to the pair object on the right side. |
operator> |
Tests if the pair object on the left side of the operator is greater than the pair object on the right side. |
operator>= |
Tests if the pair object on the left side of the operator is greater than or equal to the pair object on the right side. |
Structs
Struct | Description |
---|---|
from_chars_result |
A struct used for from_chars . |
identity |
A struct that provides a type definition as the template parameter. |
in_place_t , in_place_type_t , in_place_index_t |
Indicates how to create an object in place. |
integer_sequence |
Represents an integer sequence. |
pair |
A type that provides for the ability to treat two objects as a single object. |
piecewise_construct_t |
A type used to keep separate constructor and function overloading. |
to_chars_result |
A struct used for to_chars . |
See also
Header Files Reference
Thread Safety in the C++ Standard Library