std::array::empty
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
constexpr bool empty(); |
(C++11およびそれ以降) | |
小切手コンテナに要素がない場合、すなわちかどうかbegin() == end().
Original:
Checks if the container has no elements, i.e. whether begin() == end().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集] パラメータ
(なし)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] 値を返します
true容器が空であれば、そうでなければfalse
Original:
true if the container is empty, false otherwise
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] 例外
[編集] 複雑
定数
Original:
Constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] 例
次のコードは、
empty
に要素が含まれているかどうかをチェックするためにstd::array<int>使用しています
Original:
The following code uses
empty
to check if a std::array<int> contains any elements:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
このコードを実行します
#include <array> #include <iostream> int main() { std::array<int, 4> numbers {3, 1, 4, 1}; std::array<int, 0> no_numbers; std::cout << "numbers.empty(): " << numbers.empty() << '\n'; std::cout << "no_numbers.empty(): " << no_numbers.empty() << '\n'; }
出力:
numbers.empty(): 0 no_numbers.empty(): 1
See also
要素数を返します Original: returns the number of elements The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) |