基底数组的生存期与其他临时对象基本一样,但区别在从基底数组初始化std::initializer_list对象时会与绑定引用到临时量一样延续基底数组的生存期。 voidf(std::initializer_list<double>il);voidg(floatx){f({1, x,3});}voidh(){f({1,2,3});}structA{mutableinti;};voidq(std::initializer_list<A>...
std::initializer_list<T>类型的对象是轻量代理对象,提供对constT类型对象数组的访问(可能分配于只读内存)。 std::initializer_list对象在这些时候自动构造: 用花括号包围的初始化式列表来列表初始化一个对象,其中对应的构造函数接受一个std::initializer_list形参。
end(std::initializer_list) size_type size()constnoexcept; (since C++11) (until C++14) constexprsize_type size()constnoexcept; (since C++14) Returns the number of elements in the initializer list, i.e.std::distance(begin(), end()). ...
initializer_list(C++11) Concepts library(C++20) Diagnostics library Assertions−System error(C++11) Exception types−Error numbers basic_stacktrace(C++23) Debugging support(C++26) Memory management library Allocators−Smart pointers Memory resources(C++17) ...
オーバーロード テンプレート 例外 ヘッダ 名前付き要件 機能テストマクロ(C++20) 言語サポートライブラリ 型サポート−型特性(C++11) プログラムユーティリティ 関係比較演算子(C++20) numeric_limits−type_info initializer_list(C++11) ...
initializer_list(C++11) Concepts library(C++20) Diagnostics library Assertions−System error(C++11) Exception types−Error numbers basic_stacktrace(C++23) Debugging support(C++26) Memory management library Allocators−Smart pointers Memory resources(C++17) ...
initializer_list(C++11) Biblioteca de conceitos(C++20) Biblioteca de metaprogramming(C++11) Type traits(C++11) ratio(C++11) integer_sequencePredefinição:mark c++14 Biblioteca de diagnósticos basic_stacktracePredefinição:mark c++23
Indexing 'https://en.cppreference.com/w/cpp/utility/initializer_list' (depth 2)... Indexing 'https://en.cppreference.com/w/cpp/utility/hash' (depth 2)... Indexing 'https://en.cppreference.com/w/cpp/utility/integer_sequence' (depth 2)... Indexing 'https://en.cppreference.com/w/...
Support des types − traits (C++11) Utilitaires Compratateurs relationels (C++20) numeric_limits − type_info initializer_list (C++11)Concepts (C++20) Diagnostics Utilitaires généraux Pointeurs intelligents and allocateurs Date et heure Fonction-objets − hash (C++11) Conversion des ...