1.使用迭代器访问 例:
std::vector<std::string> funk = {"sadas","asda","sdsad123"};
for(std::vector<std::string>::iterator it = funk.begin(); it != funk.end();++it)
{
std::count << *it << std::endl;
}
2.快速访问
std::vector<std::string> funk = {"sadas","asda","sdsad123"};
for(std::string &str : funk){
std::cout << str << std::endl;
}
3.使用下标访问
std::vector<std::string> funk = {"sadas","asda","sdsad123"};
for(std::vector<std::string>::size_type index = 0; index !=funk.size();index++)
{
std::cout << funk[index] << std::endl;
}