std::semiregular
提供: cppreference.com
ヘッダ <concepts> で定義
|
||
template <class T> concept semiregular = std::copyable<T> && std::default_constructible<T>; |
(C++20以上) | |
semiregular
コンセプトはコピー可能かつデフォルト構築可能な型を表します。 これは int のような組み込み型と同様に動作する型によって満たされます。 ただし ==
を用いた比較をサポートする必要はありません。
[編集] 例
Run this code
#include <concepts> #include <iostream> template<std::semiregular T> struct Single { T value; }; int main() { Single<int> myInt1{4}; Single<int> myInt2; myInt2 = myInt1; std::cout << myInt1.value << ' ' << myInt2.value << '\n'; }
出力:
4 4