The Wayback Machine - https://web.archive.org/web/20191217094122/https://ja.cppreference.com/w/cpp/header/concepts
名前空間
変種
操作

標準ライブラリヘッダ <concepts>

提供: cppreference.com
< cpp‎ | header
 
 
 

このヘッダはコンセプトライブラリの一部です。

目次

コンセプト

コア言語のコンセプト
(C++20)
型が別の型と同じであることを指定します
(コンセプト)[edit]
型が別の型から派生していることを指定します
(コンセプト)[edit]
型が別の型に暗黙に変換可能であることを指定します
(コンセプト)[edit]
2つの型が共通の参照型を共有することを指定します
(コンセプト)[edit]
2つの型が共通の型を共有することを指定します
(コンセプト)[edit]
(C++20)
型が整数型であることを指定します
(コンセプト)[edit]
型が符号付き整数型であることを指定します
(コンセプト)[edit]
型が符号なし整数型であることを指定します
(コンセプト)[edit]
型が浮動小数点型であることを指定します
(コンセプト)[edit]
型が別の型から代入可能であることを指定します
(コンセプト)[edit]
型がスワップ可能であること、または2つの型がお互いにスワップ可能であることを指定します
(コンセプト)[edit]
その型のオブジェクトが破棄可能であることを指定します
(コンセプト)[edit]
その型の変数が与えられた実引数の集合から構築可能または束縛可能であることを指定します
(コンセプト)[edit]
その型のオブジェクトがデフォルト構築可能であることを指定します
(コンセプト)[edit]
その型のオブジェクトがムーブ構築可能であることを指定します
(コンセプト)[edit]
その型のオブジェクトがコピー構築可能かつムーブ構築可能であることを指定します
(コンセプト)[edit]
比較のコンセプト
(C++20)
型がブーリアンの文脈で使用可能であることを指定します
(コンセプト)[edit]
演算子 == が同値関係であることを指定します
(コンセプト)[edit]
型の比較演算子が全順序を与えることを指定します
(コンセプト)[edit]
オブジェクトのコンセプト
(C++20)
その型のオブジェクトがムーブ可能でありスワップ可能であることを指定します
(コンセプト)[edit]
(C++20)
その型のオブジェクトがコピー、ムーブ、およびスワップ可能であることを指定します
(コンセプト)[edit]
その型のオブジェクトがコピー、ムーブ、スワップ、およびデフォルト構築可能であることを指定します
(コンセプト)[edit]
(C++20)
型が普通である、つまり semiregular かつ equality_comparable であることを指定します
(コンセプト)[edit]
callable のコンセプト
callable 型が与えられた実引数の型の集合で呼び出せることを指定します
(コンセプト)[edit]
(C++20)
callable 型がブーリアン述語であることを指定します
(コンセプト)[edit]
(C++20)
callable 型が二項関係であることを指定します
(コンセプト)[edit]
relation が狭義弱順序を課すことを指定します
(コンセプト)[edit]

カスタマイゼーションポイントオブジェクト

2つのオブジェクトの値を入れ替えます
(カスタマイゼーションポイントオブジェクト)[edit]


[編集]概要

namespace std {// language-related concepts// concept same_astemplate<class T, class U> concept same_as =/* see description */;   // concept derived_fromtemplate<class Derived, class Base> concept derived_from =/* see description */;   // concept convertible_totemplate<class From, class To> concept convertible_to =/* see description */;   // concept common_reference_withtemplate<class T, class U> concept common_reference_with =/* see description */;   // concept common_withtemplate<class T, class U> concept common_with =/* see description */;   // arithmetic conceptstemplate<class T> concept integral =/* see description */;template<class T> concept signed_integral =/* see description */;template<class T> concept unsigned_integral =/* see description */;template<class T> concept floating_point =/* see description */;   // concept assignable_fromtemplate<class LHS, class RHS> concept assignable_from =/* see description */;   // concept swappablenamespace ranges {inlinenamespace/* unspecified */{inlineconstexpr/* unspecified */ swap =/* unspecified */;}}template<class T> concept swappable =/* see description */;template<class T, class U> concept swappable_with =/* see description */;   // concept destructibletemplate<class T> concept destructible =/* see description */;   // concept constructible_fromtemplate<class T, class... Args> concept constructible_from =/* see description */;   // concept default_constructibletemplate<class T> concept default_constructible =/* see description */;   // concept move_constructibletemplate<class T> concept move_constructible =/* see description */;   // concept copy_constructibletemplate<class T> concept copy_constructible =/* see description */;   // comparison concepts// concept booleantemplate<class B> concept boolean =/* see description */;   // concept equality_comparabletemplate<class T> concept equality_comparable =/* see description */;template<class T, class U> concept equality_comparable_with =/* see description */;   // concept totally_orderedtemplate<class T> concept totally_ordered =/* see description */;template<class T, class U> concept totally_ordered_with =/* see description */;   // object conceptstemplate<class T> concept movable =/* see description */;template<class T> concept copyable =/* see description */;template<class T> concept semiregular =/* see description */;template<class T> concept regular =/* see description */;   // callable concepts// concept invocabletemplate<class F, class... Args> concept invocable =/* see description */;   // concept regular_invocabletemplate<class F, class... Args> concept regular_invocable =/* see description */;   // concept predicatetemplate<class F, class... Args> concept predicate =/* see description */;   // concept relationtemplate<class R, class T, class U> concept relation =/* see description */;   // concept strict_weak_ordertemplate<class R, class T, class U> concept strict_weak_order =/* see description */;}

[編集]コンセプト same_as

template<class T, class U> concept __SameImpl = is_same_v<T, U>;// exposition only   template<class T, class U> concept same_as = __SameImpl<T, U>&& __SameImpl<U, T>;

[編集]コンセプト derived_from

template<class Derived, class Base> concept derived_from = is_base_of_v<Base, Derived>&& is_convertible_v<constvolatile Derived*, constvolatile Base*>;

[編集]コンセプト convertible_to

template<class From, class To> concept convertible_to = is_convertible_v<From, To>&& requires(From (&f)()){static_cast<To>(f());};

[編集]コンセプト 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>>;

[編集]コンセプト 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>>>;

[編集]コンセプト integral

template<class T> concept integral = is_integral_v<T>;

[編集]コンセプト signed_integral

template<class T> concept signed_integral = integral<T>&& is_signed_v<T>;

[編集]コンセプト unsigned_integral

template<class T> concept unsigned_integral = integral<T>&&!signed_integral<T>;

[編集]コンセプト floating_point

template<class T> concept floating_point = is_floating_point_v<T>;

[編集]コンセプト 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>;

[編集]コンセプト swappable

template<class T> concept swappable = requires(T& a, T& b){ ranges::swap(a, b);};

[編集]コンセプト swappable_with

template<class T, class U> concept swappable_with = common_reference_with<const remove_reference_t<T>&, const remove_reference_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));};

[編集]コンセプト destructible

template<class T> concept destructible = is_nothrow_destructible_v<T>;

[編集]コンセプト constructible_from

template<class T, class... Args> concept constructible_from = destructible<T>&& is_constructible_v<T, Args...>;

[編集]コンセプト default_constructible

template<class T> concept default_constructible = constructible_from<T>;

[編集]コンセプト move_constructible

template<class T> concept move_constructible = constructible_from<T, T>&& convertible_to<T, T>;

[編集]コンセプト 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>;

[編集]コンセプト boolean

template<class B> concept boolean = movable<remove_cvref_t<B>>&& requires(const remove_reference_t<B>& b1, const remove_reference_t<B>& b2, constbool a){{ b1 }-> convertible_to<bool>;{!b1 }-> convertible_to<bool>;{ b1 && b2 }-> same_as<bool>;{ b1 && a }-> same_as<bool>;{ a && b2 }-> same_as<bool>;{ b1 || b2 }-> same_as<bool>;{ b1 || a }-> same_as<bool>;{ a || b2 }-> same_as<bool>;{ b1 == b2 }-> convertible_to<bool>;{ b1 == a }-> convertible_to<bool>;{ a == b2 }-> convertible_to<bool>;{ b1 != b2 }-> convertible_to<bool>;{ b1 != a }-> convertible_to<bool>;{ a != b2 }-> convertible_to<bool>;};

[編集]コンセプト equality_comparable

template<class T, class U> concept __WeaklyEqualityComparableWith =// exposition only requires(const remove_reference_t<T>& t, const remove_reference_t<U>& u){{ t == u }-> boolean;{ t != u }-> boolean;{ u == t }-> boolean;{ u != t }-> boolean;};   template<class T> concept equality_comparable = __WeaklyEqualityComparableWith<T, T>;

[編集]コンセプト equality_comparable_with

template<class T, class U> concept equality_comparable_with = equality_comparable<T>&& equality_comparable<U>&& common_reference_with<const remove_reference_t<T>&, const remove_reference_t<U>&>&& equality_comparable< common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>>&& __WeaklyEqualityComparableWith<T, U>;

[編集]コンセプト totally_ordered

template<class T> concept totally_ordered = equality_comparable<T>&& requires(const remove_reference_t<T>& a, const remove_reference_t<T>& b){{ a < b }-> boolean;{ a > b }-> boolean;{ a <= b }-> boolean;{ a >= b }-> boolean;};

[編集]コンセプト totally_ordered_with

template<class T, class U> concept totally_ordered_with = totally_ordered<T>&& totally_ordered<U>&& common_reference_with<const remove_reference_t<T>&, const remove_reference_t<U>&>&& totally_ordered< common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>>&& equality_comparable_with<T, U>&& requires(const remove_reference_t<T>& t, const remove_reference_t<U>& u){{ t < u }-> boolean;{ t > u }-> boolean;{ t <= u }-> boolean;{ t >= u }-> boolean;{ u < t }-> boolean;{ u > t }-> boolean;{ u <= t }-> boolean;{ u >= t }-> boolean;};

[編集]コンセプト movable

template<class T> concept movable = is_object_v<T>&& move_constructible<T>&& assignable_from<T&, T>&& swappable<T>;

[編集]コンセプト copyable

template<class T> concept copyable = copy_constructible<T>&& movable<T>&& assignable_from<T&, const T&>;

[編集]コンセプト semiregular

template<class T> concept semiregular = copyable<T>&& default_constructible<T>;

[編集]コンセプト regular

template<class T> concept regular = semiregular<T>&& equality_comparable<T>;

[編集]コンセプト invocable

template<class F, class... Args> concept invocable = requires(F&& f, Args&&... args){ invoke(std::forward<F>(f), std::forward<Args>(args)...);// not required to be equality-preserving};

[編集]コンセプト regular_invocable

template<class F, class... Args> concept regular_invocable = invocable<F, Args...>;

[編集]コンセプト predicate

template<class F, class... Args> concept predicate = regular_invocable<F, Args...>&& boolean<invoke_result_t<F, Args...>>;

[編集]コンセプト 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>;

[編集]コンセプト strict_weak_order

template<class R, class T, class U> concept strict_weak_order = relation<R, T, U>;
close