Namensräume
Varianten
Aktionen

Header der Standardbibliothek <utility>

Aus cppreference.com
< cpp‎ | header
 
 
Headerdateien der Standardbibliothek
Language Support
<tr class="t-nv"><td colspan="5">
</td></tr>
<cfloat>
<cstdint>
<new>
<typeinfo>
<tr class="t-nv"><td colspan="5">
</td></tr>
<source_location>
<exception>
<initializer_list>    
<compare>
<tr class="t-nv"><td colspan="5">
</td></tr>
<coroutine>
<csignal>
<csetjmp>
<cstdarg>
Concepts
<concepts>
Diagnostics
General utilities
Strings
<tr class="t-nv"><td colspan="5">
</td></tr>
<charconv>
<format>
<tr class="t-nv"><td colspan="5">
</td></tr>
<cctype>
<cwctype>
<tr class="t-nv"><td colspan="5">
</td></tr>
<cwchar>
<cuchar>
Localization
Containers
Iterators
<iterator>
Ranges
<ranges>
Algorithms
Numerics
Input/Output
<tr class="t-nv"><td colspan="5">
</td></tr>
<istream>
<ostream>
<iostream>
<tr class="t-nv"><td colspan="5">
</td></tr>
<cstdio>
<cinttypes>
<strstream>
Regular expressions
<regex>
Filesystem support
<filesystem>
Thread support
<tr class="t-nv"><td colspan="5">
</td></tr>
<stop_token>
<semaphore>
<tr class="t-nv"><td colspan="5">
</td></tr>
<latch>
<barrier>
C compatibility
 

Diese Headerdatei ist Teil der Bibliothek general utility.

Vorlage:cpp/header/dsc initializer listVorlage:cpp/utility/dsc unreachable

Inhaltsverzeichnis

Inkludierte Headerdateien

(C++20)
Operator für den Dreiwegevergleich [edit]

Namensräume

rel_ops stellt automatische Vergleichsoperatoren zur Verfügung
definiert in Namensraum std::rel_ops
automatically generates comparison operators based on user-defined operator== and operator<
(Funktions-Template) [edit]

Funktionen

tauscht die Werte von zwei Objekten
Original:
swaps the values of two objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template) [edit]
(C++14)
ersetzt das Argument durch einen neuen Wert und gibt den alten Wert zurück
(Funktions-Template) [edit]
(C++11)
leitet eine Funktion Argument
Original:
forwards a function argument
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template) [edit]
(C++11)
erhält einen rvalue Referenz
Original:
obtains an rvalue reference
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template) [edit]
erhält eine rvalue Referenz, wenn der Umzug Konstruktor nicht werfen wird
Original:
obtains an rvalue reference if the move constructor does not throw
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template) [edit]
(C++17)
erzeugt eine Referenz auf eine Konstante des Argumentes
(Funktions-Template) [edit]
(C++11)
erhält die Art des Ausdrucks in unevaluierten Kontext
Original:
obtains the type of expression in unevaluated context
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template) [edit]
konvertiert einen Aufzählungswert in den zugrundeliegenden Typ der Aufzählung
(Funktions-Template) [edit]
vergleicht zwei Ganzzahlen ohne Wertveränderung durch Konvertierung
(Funktions-Template) [edit]
(C++20)
überprüft, ob ein Ganzzahlwert im Wertebereich eines gegebenen Ganzzahltyps liegt
(Funktions-Template) [edit]
schafft eine pair Objekt des Typs, durch das Argument definiert
Original:
creates a pair object of type, defined by the argument types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template) [edit]
vergleicht die Werte in dem Paar lexikographisch
Original:
lexicographically compares the values in the pair
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template) [edit]
spezialisiert die std::swap Algorithmus
Original:
specializes the std::swap algorithm
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template) [edit]
greift ein Element eines pair
Original:
accesses an element of a pair
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktions-Template) [edit]

Klassen

implementiert binären Tupel, d.h. ein Paar von Werten
Original:
implements binary tuple, i.e. a pair of values
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Klassen-Template) [edit]
gibt die Anzahl der Elemente für einen Typ, der sich wie ein std::tuple verhält
(Klassen-Template) [edit]
gibt den Typ eines Elementes für einen Typ, der sich wie ein std::tuple verhält
(Klassen-Template) [edit]
erhält die Größe eines pair
Original:
obtains the size of a pair
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(class Template-Spezialisierung) [edit]
ermittelt die Art der Elemente der pair
Original:
obtains the type of the elements of pair
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(class Template-Spezialisierung) [edit]
bietet eine Folge von Ganzzahlen zur Kompilationszeit
(Klassen-Template) [edit]
Vorwärtsdeklarationen
definiert in Header <tuple>
(C++11)
implementiert Container fester Größe, die Elemente von potentiell unterschiedlichen Datentypen enthalten können
Original:
implements fixed size container, which holds elements of possibly different types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Klassen-Template) [edit]

Hilfsfunktionen

Tag-Typ verwendet werden, um die korrekte Funktion Überlast für stückweise Konstruktion auszuwählen
Original:
tag type used to select correct function overload for piecewise construction
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Klasse) [edit]
ein Objekt vom Typ piecewise_construct_t verwendet, um Funktionen für stückweise Konstruktion eindeutig zu machen
Original:
an object of type piecewise_construct_t used to disambiguate functions for piecewise construction
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(konstanten) [edit]
Marker für in-place-Konstruktion
(Klassen-Template) [edit]

[Bearbeiten] Inhaltsübersicht

#include <compare>
#include <initializer_list>
 
namespace std {
  // swap
  template<class T>
    constexpr void swap(T& a, T& b) noexcept(/* see description */);
  template<class T, size_t N>
    constexpr void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>);
 
  // exchange
  template<class T, class U = T>
    constexpr T exchange(T& obj, U&& new_val);
 
  // forward/move
  template<class T>
    constexpr T&& forward(remove_reference_t<T>& t) noexcept;
  template<class T>
    constexpr T&& forward(remove_reference_t<T>&& t) noexcept;
  template<class T>
    constexpr remove_reference_t<T>&& move(T&&) noexcept;
  template<class T>
    constexpr conditional_t<
        !is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>, const T&, T&&>
      move_if_noexcept(T& x) noexcept;
 
  // as_const
  template<class T>
    constexpr add_const_t<T>& as_const(T& t) noexcept;
  template<class T>
    void as_const(const T&&) = delete;
 
  // declval
  template<class T>
    add_rvalue_reference_t<T> declval() noexcept;   // as unevaluated operand
 
  // integer comparison functions
  template<class T, class U>
    constexpr bool cmp_equal(T t, U u) noexcept;
  template<class T, class U>
    constexpr bool cmp_not_equal(T t, U u) noexcept;
 
  template<class T, class U>
    constexpr bool cmp_less(T t, U u) noexcept;
  template<class T, class U>
    constexpr bool cmp_greater(T t, U u) noexcept;
  template<class T, class U>
    constexpr bool cmp_less_equal(T t, U u) noexcept;
  template<class T, class U>
    constexpr bool cmp_greater_equal(T t, U u) noexcept;
 
  template<class R, class T>
    constexpr bool in_range(T t) noexcept;
 
  // to_underlying
  template<class T>
    constexpr underlying_type_t<T> to_underlying(T value) noexcept;
 
  // compile-time integer sequences
  template<class T, T...>
    struct integer_sequence;
  template<size_t... I>
    using index_sequence = integer_sequence<size_t, I...>;
 
  template<class T, T N>
    using make_integer_sequence = integer_sequence<T, /* see description */>;
  template<size_t N>
    using make_index_sequence = make_integer_sequence<size_t, N>;
 
  template<class... T>
    using index_sequence_for = make_index_sequence<sizeof...(T)>;
 
  // class template pair
  template<class T1, class T2>
    struct pair;
 
  // pair specialized algorithms
  template<class T1, class T2>
    constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&);
  template<class T1, class T2>
    constexpr common_comparison_category_t</*synth-three-way-result*/<T1>,
                                           /*synth-three-way-result*/<T2>>
      operator<=>(const pair<T1, T2>&, const pair<T1, T2>&);
 
  template<class T1, class T2>
    constexpr void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
 
  template<class T1, class T2>
    constexpr /* see description */ make_pair(T1&&, T2&&);
 
  // tuple-like access to pair
  template<class T> struct tuple_size;
  template<size_t I, class T> struct tuple_element;
 
  template<class T1, class T2> struct tuple_size<pair<T1, T2>>;
  template<size_t I, class T1, class T2> struct tuple_element<I, pair<T1, T2>>;
 
  template<size_t I, class T1, class T2>
    constexpr tuple_element_t<I, pair<T1, T2>>& get(pair<T1, T2>&) noexcept;
  template<size_t I, class T1, class T2>
    constexpr tuple_element_t<I, pair<T1, T2>>&& get(pair<T1, T2>&&) noexcept;
  template<size_t I, class T1, class T2>
    constexpr const tuple_element_t<I, pair<T1, T2>>& get(const pair<T1, T2>&) noexcept;
  template<size_t I, class T1, class T2>
    constexpr const tuple_element_t<I, pair<T1, T2>>&& get(const pair<T1, T2>&&) noexcept;
  template<class T1, class T2>
    constexpr T1& get(pair<T1, T2>& p) noexcept;
  template<class T1, class T2>
    constexpr const T1& get(const pair<T1, T2>& p) noexcept;
  template<class T1, class T2>
    constexpr T1&& get(pair<T1, T2>&& p) noexcept;
  template<class T1, class T2>
    constexpr const T1&& get(const pair<T1, T2>&& p) noexcept;
  template<class T2, class T1>
    constexpr T2& get(pair<T1, T2>& p) noexcept;
  template<class T2, class T1>
    constexpr const T2& get(const pair<T1, T2>& p) noexcept;
  template<class T2, class T1>
    constexpr T2&& get(pair<T1, T2>&& p) noexcept;
  template<class T2, class T1>
    constexpr const T2&& get(const pair<T1, T2>&& p) noexcept;
 
  // pair piecewise construction
  struct piecewise_construct_t {
    explicit piecewise_construct_t() = default;
  };
  inline constexpr piecewise_construct_t piecewise_construct{};
  template<class... Types> class tuple;         // defined in <tuple>
 
  // in-place construction
  struct in_place_t {
    explicit in_place_t() = default;
  };
  inline constexpr in_place_t in_place{};
 
  template<class T>
    struct in_place_type_t {
      explicit in_place_type_t() = default;
    };
  template<class T> inline constexpr in_place_type_t<T> in_place_type{};
 
  template<size_t I>
    struct in_place_index_t {
      explicit in_place_index_t() = default;
    };
  template<size_t I> inline constexpr in_place_index_t<I> in_place_index{};
 
  // unreachable
  [[noreturn]] void unreachable();
}
 
// deprecated
namespace std::rel_ops {
  template<class T> bool operator!=(const T&, const T&);
  template<class T> bool operator> (const T&, const T&);
  template<class T> bool operator<=(const T&, const T&);
  template<class T> bool operator>=(const T&, const T&);
}

[Bearbeiten] Klassetemplate std::integer_sequence

namespace std {
  template<class T, T... I> struct integer_sequence {
    using value_type = T;
    static constexpr size_t size() noexcept { return sizeof...(I); }
  };
}

[Bearbeiten] Klassentemplate std::pair

namespace std {
  template<class T1, class T2>
  struct pair {
    using first_type  = T1;
    using second_type = T2;
 
    T1 first;
    T2 second;
 
    pair(const pair&) = default;
    pair(pair&&) = default;
    constexpr explicit(/* see description */) pair();
    constexpr explicit(/* see description */) pair(const T1& x, const T2& y);
    template<class U1 = T1, class U2 = T2>
      constexpr explicit(/* see description */) pair(U1&& x, U2&& y);
    template<class U1, class U2>
      constexpr explicit(/* see description */) pair(const pair<U1, U2>& p);
    template<class U1, class U2>
      constexpr explicit(/* see description */) pair(pair<U1, U2>&& p);
    template<class... Args1, class... Args2>
      constexpr pair(piecewise_construct_t,
                     tuple<Args1...> first_args, tuple<Args2...> second_args);
 
    constexpr pair& operator=(const pair& p);
    template<class U1, class U2>
      constexpr pair& operator=(const pair<U1, U2>& p);
    constexpr pair& operator=(pair&& p) noexcept(/* see description */);
    template<class U1, class U2>
      constexpr pair& operator=(pair<U1, U2>&& p);
 
    constexpr void swap(pair& p) noexcept(/* see description */);
  };
 
  template<class T1, class T2>
    pair(T1, T2) -> pair<T1, T2>;
}

[Bearbeiten] Referenzen

Vorlage:cpp/header/dsc tuple