int main (int argc, char* argv[])
{
vectornumbers;
cout
<< "vector:" << endl;
for (int i =
0; i < 10; ++i) {
numbers.push_back (i);
cout << i << " ";
}
cout
<< endl << "---------------------------------------"
<< endl;
cout
<< "用反向迭代器逆序输出vector:" << endl;
for_each
(numbers.crbegin (), numbers.crend (), [] (const int &i){cout
<< i << " "; });
cout
<<endl << "---------------------------------------"
<< endl;
cout
<< "用普通迭代器逆序输出vector:" << endl;
for (auto it
= numbers.cend (); it > numbers.begin ();)
cout << *--it << " ";
cout
<< endl;
return
0;
}
{
}