Skip to content

Commit

Permalink
bettered example
Browse files Browse the repository at this point in the history
  • Loading branch information
lformaggia committed Apr 16, 2024
1 parent 51f0eb2 commit 8934e45
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Examples/src/STL/Sort/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ main()
// The {} indicate to use the default comparison, which is here less<char
// I show the std::ranges::copy to print the vector
std::ranges::copy(s, std::ostream_iterator<std::string>(std::cout, " "));
// but you can also use for_each
// std::ranges::for_each(s, [](auto const &i) {std::cout << i << " "; });
/* the same with a for loop
for(auto const & i :s)
cout << i << " ";
Expand Down

0 comments on commit 8934e45

Please sign in to comment.