mirror of
https://github.com/boostorg/array.git
synced 2025-07-27 11:17:34 +02:00
array3.cpp:
- Qualify std::swap for compilers that don't have Koenig lookup array5.cpp: - Don't use std::boolalpha, because it isn't portable [SVN r12463]
This commit is contained in:
@ -17,7 +17,7 @@ int main()
|
|||||||
// copy and change order
|
// copy and change order
|
||||||
boost::array<std::string,4> seasons_orig = seasons;
|
boost::array<std::string,4> seasons_orig = seasons;
|
||||||
for (unsigned i=seasons.size()-1; i>0; --i) {
|
for (unsigned i=seasons.size()-1; i>0; --i) {
|
||||||
swap(seasons.at(i),seasons.at((i+1)%seasons.size()));
|
std::swap(seasons.at(i),seasons.at((i+1)%seasons.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "one way: ";
|
std::cout << "one way: ";
|
||||||
@ -25,7 +25,7 @@ int main()
|
|||||||
|
|
||||||
// try swap()
|
// try swap()
|
||||||
std::cout << "other way: ";
|
std::cout << "other way: ";
|
||||||
swap(seasons,seasons_orig);
|
std::swap(seasons,seasons_orig);
|
||||||
print_elements(seasons);
|
print_elements(seasons);
|
||||||
|
|
||||||
// try reverse iterators
|
// try reverse iterators
|
||||||
|
@ -27,7 +27,8 @@ int main()
|
|||||||
// use some common STL container operations
|
// use some common STL container operations
|
||||||
std::cout << "static_size: " << a.size() << std::endl;
|
std::cout << "static_size: " << a.size() << std::endl;
|
||||||
std::cout << "size: " << a.size() << std::endl;
|
std::cout << "size: " << a.size() << std::endl;
|
||||||
std::cout << "empty: " << std::boolalpha << a.empty() << std::endl;
|
// Can't use std::boolalpha because it isn't portable
|
||||||
|
std::cout << "empty: " << (a.empty()? "true" : "false") << std::endl;
|
||||||
std::cout << "max_size: " << a.max_size() << std::endl;
|
std::cout << "max_size: " << a.max_size() << std::endl;
|
||||||
std::cout << "front: " << a.front() << std::endl;
|
std::cout << "front: " << a.front() << std::endl;
|
||||||
std::cout << "back: " << a.back() << std::endl;
|
std::cout << "back: " << a.back() << std::endl;
|
||||||
|
Reference in New Issue
Block a user