Standard library header <concepts> (C++20)
From cppreference.net
Dieser Header ist Teil der Concepts -Bibliothek.
Konzepte |
|
Kernsprachkonzepte |
|
|
(C++20)
|
spezifiziert, dass ein Typ identisch mit einem anderen Typ ist
(Konzept) |
|
(C++20)
|
gibt an, dass ein Typ von einem anderen Typ abgeleitet ist
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein Typ implizit in einen anderen Typ konvertierbar ist
(Konzept) |
|
(C++20)
|
spezifiziert, dass zwei Typen einen gemeinsamen Referenztyp teilen
(Konzept) |
|
(C++20)
|
spezifiziert, dass zwei Typen einen gemeinsamen Typ teilen
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein Typ ein integraler Typ ist
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein Typ ein vorzeichenbehafteter Ganzzahltyp ist
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein Typ ein integraler Typ ohne Vorzeichen ist
(Konzept) |
|
(C++20)
|
gibt an, dass ein Typ ein Gleitkommatyp ist
(Konzept) |
|
(C++20)
|
gibt an, dass ein Typ von einem anderen Typ zuweisbar ist
(Konzept) |
|
(C++20)
|
gibt an, dass ein Typ ausgetauscht werden kann oder dass zwei Typen miteinander ausgetauscht werden können
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein Objekt des Typs zerstört werden kann
(Konzept) |
|
(C++20)
|
gibt an, dass eine Variable des Typs aus oder an eine Menge von Argumenttypen konstruiert oder gebunden werden kann
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein Objekt eines Typs standardmäßig konstruiert werden kann
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein Objekt eines Typs move-konstruiert werden kann
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein Objekt eines Typs kopierkonstruiert und bewegungskonstruiert werden kann
(Konzept) |
Vergleichskonzepte |
|
|
spezifiziert, dass der Operator
==
eine Äquivalenzrelation ist
(Konzept) |
|
|
spezifiziert, dass die Vergleichsoperatoren des Typs eine Totalordnung ergeben
(Konzept) |
|
Objektkonzepte |
|
|
(C++20)
|
gibt an, dass ein Objekt eines Typs verschoben und ausgetauscht werden kann
(Konzept) |
|
(C++20)
|
gibt an, dass ein Objekt eines Typs kopiert, verschoben und ausgetauscht werden kann
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein Objekt eines Typs kopiert, verschoben, getauscht und standardkonstruiert werden kann
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein Typ regulär ist, das heißt, er ist sowohl
semiregular
als auch
equality_comparable
(Konzept) |
Callable-Konzepte |
|
|
(C++20)
|
spezifiziert, dass ein aufrufbarer Typ mit einem gegebenen Satz von Argumenttypen aufgerufen werden kann
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein aufrufbarer Typ ein boolesches Prädikat ist
(Konzept) |
|
(C++20)
|
spezifiziert, dass ein aufrufbarer Typ eine binäre Relation ist
(Konzept) |
|
(C++20)
|
spezifiziert, dass eine
relation
eine Äquivalenzrelation definiert
(Konzept) |
|
(C++20)
|
spezifiziert, dass eine
relation
eine strikte schwache Ordnung erzeugt
(Konzept) |
Customization Point Objects |
|
|
(C++20)
|
tauscht die Werte zweier Objekte
(Anpassungspunktobjekt) |
Synopsis
// alle freestanding namespace std { // sprachbezogene Konzepte // Konzept same_as template<class T, class U> concept same_as = /* siehe Beschreibung */; // Konzept derived_from template<class Derived, class Base> concept derived_from = /* siehe Beschreibung */; // Konzept convertible_to template<class From, class To> concept convertible_to = /* siehe Beschreibung */; // Konzept common_reference_with template<class T, class U> concept common_reference_with = /* siehe Beschreibung */; // Konzept common_with template<class T, class U> concept common_with = /* siehe Beschreibung */; // arithmetische Konzepte template<class T> concept integral = /* siehe Beschreibung */; template<class T> concept signed_integral = /* siehe Beschreibung */; template<class T> concept unsigned_integral = /* siehe Beschreibung */; template<class T> concept floating_point = /* siehe Beschreibung */; // Konzept assignable_from template<class LHS, class RHS> concept assignable_from = /* siehe Beschreibung */; // Konzept swappable namespace ranges { inline namespace /* unspecified */ { inline constexpr /* unspecified */ swap = /* unspecified */; } } template<class T> concept swappable = /* siehe Beschreibung */; template<class T, class U> concept swappable_with = /* siehe Beschreibung */; // Konzept destructible template<class T> concept destructible = /* siehe Beschreibung */; // Konzept constructible_from template<class T, class... Args> concept constructible_from = /* siehe Beschreibung */; // Konzept default_initializable template<class T> concept default_initializable = /* siehe Beschreibung */; // Konzept move_constructible template<class T> concept move_constructible = /* siehe Beschreibung */; // Konzept copy_constructible template<class T> concept copy_constructible = /* siehe Beschreibung */; // Vergleichskonzepte // Konzept equality_comparable template<class T> concept equality_comparable = /* siehe Beschreibung */; template<class T, class U> concept equality_comparable_with = /* siehe Beschreibung */; // Konzept totally_ordered template<class T> concept totally_ordered = /* siehe Beschreibung */; template<class T, class U> concept totally_ordered_with = /* siehe Beschreibung */; // Objektkonzepte template<class T> concept movable = /* siehe Beschreibung */; template<class T> concept copyable = /* siehe Beschreibung */; template<class T> concept semiregular = /* siehe Beschreibung */; template<class T> concept regular = /* siehe Beschreibung */; // aufrufbare Konzepte // Konzept invocable template<class F, class... Args> concept invocable = /* siehe Beschreibung */; // Konzept regular_invocable template<class F, class... Args> concept regular_invocable = /* siehe Beschreibung */; // Konzept predicate template<class F, class... Args> concept predicate = /* siehe Beschreibung */; // Konzept relation template<class R, class T, class U> concept relation = /* siehe Beschreibung */; // Konzept equivalence_relation template<class R, class T, class U> concept equivalence_relation = /* siehe Beschreibung */; // Konzept strict_weak_order template<class R, class T, class U> concept strict_weak_order = /* siehe Beschreibung */; }
Hilfskonzept
boolean-testable
template<class T> concept /*boolean-testable-impl*/ = convertible_to<T, bool>; // nur zur Darstellung; template<class T> concept boolean-testable = // nur zur Darstellung /*boolean-testable-impl*/<T> && requires(T&& t) { { !std::forward<T>(t) } -> /*boolean-testable-impl*/; };
Konzept
same_as
template<class T, class U> concept /*same-as-impl*/ = is_same_v<T, U>; // nur zur Darstellung template<class T, class U> concept same_as = /*same-as-impl*/<T, U> && /*same-as-impl*/<U, T>;
Konzept
derived_from
template<class Derived, class Base> concept derived_from = is_base_of_v<Base, Derived> && is_convertible_v<const volatile Derived*, const volatile Base*>;
Konzept
convertible_to
template<class From, class To> concept convertible_to = is_convertible_v<From, To> && requires { static_cast<To>(declval<From>()); };
Konzept
common_reference_with
template<class T, class U> concept common_reference_with = same_as<common_reference_t<T, U>, common_reference_t<U, T>> && convertible_to<T, common_reference_t<T, U>> && convertible_to<U, common_reference_t<T, U>>;
Konzept
common_with
template<class T, class U> concept common_with = same_as<common_type_t<T, U>, common_type_t<U, T>> && requires { static_cast<common_type_t<T, U>>(declval<T>()); static_cast<common_type_t<T, U>>(declval<U>()); } && common_reference_with<add_lvalue_reference_t<const T>, add_lvalue_reference_t<const U>> && common_reference_with< add_lvalue_reference_t<common_type_t<T, U>>, common_reference_t<add_lvalue_reference_t<const T>, add_lvalue_reference_t<const U>>>;
Konzept
integral
template<class T> concept integral = is_integral_v<T>;
Konzept
signed_integral
template<class T> concept signed_integral = integral<T> && is_signed_v<T>;
Konzept
unsigned_integral
template<class T> concept unsigned_integral = integral<T> && !signed_integral<T>;
Konzept
floating_point
template<class T> concept floating_point = is_floating_point_v<T>;
Konzept
assignable_from
template<class LHS, class RHS> concept assignable_from = is_lvalue_reference_v<LHS> && common_reference_with<const remove_reference_t<LHS>&, const remove_reference_t<RHS>&> && requires(LHS lhs, RHS&& rhs) { { lhs = std::forward<RHS>(rhs) } -> same_as<LHS>; };
` und `` Tags wurde nicht übersetzt, da es sich um C++-Code handelt
- HTML-Tags, Attribute und Formatierung wurden vollständig beibehalten
- C++-spezifische Begriffe wie `template`, `concept`, `requires`, `std::forward` etc. wurden nicht übersetzt
- Nur der strukturelle Kontext wurde für die deutsche Lokalisierung bereitgestellt
Konzept
swappable
template<class T> concept swappable = requires(T& a, T& b) { ranges::swap(a, b); };
Konzept
swappable_with
template<class T, class U> concept swappable_with = common_reference_with<T, U> && requires(T&& t, U&& u) { ranges::swap(std::forward<T>(t), std::forward<T>(t)); ranges::swap(std::forward<U>(u), std::forward<U>(u)); ranges::swap(std::forward<T>(t), std::forward<U>(u)); ranges::swap(std::forward<U>(u), std::forward<T>(t)); };
` und `` Tags wurde gemäß den Anweisungen nicht übersetzt, da es sich um C++-Code handelt. Die HTML-Struktur, Attribute und der C++-Code bleiben unverändert.
Konzept
destructible
template<class T> concept destructible = is_nothrow_destructible_v<T>;
Konzept
constructible_from
template<class T, class... Args> concept constructible_from = destructible<T> && is_constructible_v<T, Args...>;
Konzept
default_initializable
template<class T> constexpr bool /*is-default-initializable*/ = /* siehe Beschreibung */; // nur zur Darstellung template<class T> concept default_initializable = constructible_from<T> && requires { T{}; } && /*is-default-initializable*/<T>;
Konzept
move_constructible
template<class T> concept move_constructible = constructible_from<T, T> && convertible_to<T, T>;
Konzept
copy_constructible
template<class T> concept copy_constructible = move_constructible<T> && constructible_from<T, T&> && convertible_to<T&, T> && constructible_from<T, const T&> && convertible_to<const T&, T> && constructible_from<T, const T> && convertible_to<const T, T>;
Konzept
equality_comparable
template<class T, class U> concept /*weakly-equality-comparable-with*/ = // nur zur Darstellung requires(const remove_reference_t<T>& t, const remove_reference_t<U>& u) { { t == u } -> boolean-testable; { t != u } -> boolean-testable; { u == t } -> boolean-testable; { u != t } -> boolean-testable; }; template<class T> concept equality_comparable = /*weakly-equality-comparable-with*/<T, T>;
Konzept
equality_comparable_with
template<class T, class U, class C = common_reference_t<const T&, const U&>> concept /*comparison-common-type-with-impl*/ = // nur zur Darstellung same_as<common_reference_t<const T&, const U&>, common_reference_t<const U&, const T&>> && requires { requires convertible_to<const T&, const C&> || convertible_to<T, const C&>; requires convertible_to<const U&, const C&> || convertible_to<U, const C&>; }; template<class T, class U> concept /*comparison-common-type-with*/ = // nur zur Darstellung /*comparison-common-type-with-impl*/<remove_cvref_t<T>, remove_cvref_t<U>>; template<class T, class U> concept equality_comparable_with = equality_comparable<T> && equality_comparable<U> && /*comparison-common-type-with*/<T, U> && equality_comparable< common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>> && /*weakly-equality-comparable-with*/<T, U>;
Hilfskonzept partially-ordered-with
Definiert im Header <compare>
template<class T, class U> concept /*teilweise-geordnet-mit*/ = // nur zur Darstellung requires(const remove_reference_t<T>& t, const remove_reference_t<U>& u) { { t < u } -> boolean-testable; { t > u } -> boolean-testable; { t <= u } -> boolean-testable; { t >= u } -> boolean-testable; { u < t } -> boolean-testable; { u > t } -> boolean-testable; { u <= t } -> boolean-testable; { u >= t } -> boolean-testable; };
` Tags (C++ Code) - C++ spezifische Begriffe wie `template`, `class`, `concept`, `requires`, `const`, `remove_reference_t`, `boolean-testable` - Vergleichsoperatoren und Syntaxelemente
Konzept
totally_ordered
template<class T> concept totally_ordered = equality_comparable<T> && /*partially-ordered-with*/<T, T>;
Konzept
totally_ordered_with
template<class T, class U> concept totally_ordered_with = totally_ordered<T> && totally_ordered<U> && equality_comparable_with<T, U> && totally_ordered< common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>> && /*partially-ordered-with*/<T, U>;
` und `` Tags wurde nicht übersetzt, da dies gemäß den Anweisungen spezifische C++-Begriffe und Code-Strukturen enthält. Die HTML-Tags und Attribute wurden ebenfalls unverändert beibehalten.
Konzept
movable
template<class T> concept movable = is_object_v<T> && move_constructible<T> && assignable_from<T&, T> && swappable<T>;
Konzept
copyable
template<class T> concept copyable = copy_constructible<T> && movable<T> && assignable_from<T&, T&> && assignable_from<T&, const T&> && assignable_from<T&, const T>;
Konzept
semiregular
template<class T> concept semiregular = copyable<T> && default_initializable<T>;
Konzept
regular
template<class T> concept regular = semiregular<T> && equality_comparable<T>;
Konzept
invocable
template<class F, class... Args> concept invocable = requires(F&& f, Args&&... args) { invoke(std::forward<F>(f), std::forward<Args>(args)...); // nicht erforderlich, gleichheitserhaltend zu sein };
Konzept
regular_invocable
template<class F, class... Args> concept regular_invocable = invocable<F, Args...>;
Konzept
predicate
template<class F, class... Args> concept Prädikat = regular_invocable<F, Args...> && boolean-testable<invoke_result_t<F, Args...>>;
Konzept
relation
template<class R, class T, class U> concept relation = predicate<R, T, T> && predicate<R, U, U> && predicate<R, T, U> && predicate<R, U, T>;
Konzept
equivalence_relation
template<class R, class T, class U> concept Äquivalenzrelation = relation<R, T, U>;
Konzept
strict_weak_order
template<class R, class T, class U> concept strict_weak_order = relation<R, T, U>;