std::array
に対する推定ガイド
提供: cppreference.com
ヘッダ <array> で定義 | ||
template<class T, class... U> array(T, U...)-> array<T, 1+ sizeof...(U)>; | (C++17以上) | |
可変個パラメータパックから std::array を構築するために std::experimental::make_array と同等の機能を提供するために std::array に対して1つの推定ガイドが提供されます。
(std::is_same_v<T, U> && ...) が true でなければプログラムは ill-formed です。
[編集]例
Run this code
#include <array>int main(){intconst x =10;std::array a{1, 2, 3, 5, x};// OK, creates std::array<int, 5> // std::array b{1, 2u}; // Error, all arguments must have same type}