MSVCRT std::vector 新しいページはコチラ
提供: yonewiki
(→メンバ関数 push_back) |
(→メンバ関数 push_back) |
||
119行: | 119行: | ||
objVectorStdString_data.emplase_back(std::string("Hello! VectorDataString!")); | objVectorStdString_data.emplase_back(std::string("Hello! VectorDataString!")); | ||
//std::stringのコンストラクタでstd::string型そのものが右辺値参照として引数になる。 | //std::stringのコンストラクタでstd::string型そのものが右辺値参照として引数になる。 | ||
− | for(std::string objStdString_arg: | + | for(std::string objStdString_arg: objVectorStdString_data){ |
obj.push_back(objStdString_arg.data()) | obj.push_back(objStdString_arg.data()) | ||
} | } | ||
125行: | 125行: | ||
</syntaxhighlight2> | </syntaxhighlight2> | ||
− | + | 範囲に基づくfor文を利用して、Vector<std::string>型のstd::string型の値をひとつづつを取り出しています。分からない人は[[Cpp 範囲に基づくfor文]]の記事を参照して下さい。C++言語版のforeachと同様の機能がC++11から追加されたことについての記事になっています。 | |
[[Windows#MSVC Runtimeリファレンス|MSVC Runtimeリファレンス]]に戻る | [[Windows#MSVC Runtimeリファレンス|MSVC Runtimeリファレンス]]に戻る |