C++ Library Extensions
2022.12.09
To help learn modern C++ programming
054-iterator.cpp
Go to the documentation of this file.
1
#include <
tpf_output.hpp
>
2
3
tpf::sstream
stream
;
4
auto
endl
=
tpf::endl
;
5
6
void
test_reverse_iterator
()
7
{
8
int
array[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
9
10
for
(
auto
& e:
tpf::reverse
(array))
11
{
12
++e;
13
stream
<< e <<
", "
;
14
}
15
16
stream
<<
endl
;
17
18
for
(
auto
& e: array)
19
{
20
stream
<< e <<
", "
;
21
}
22
23
auto
clone =
tpf::reverse
(array).clone();
24
25
stream
<< clone <<
endl
;
26
}
27
28
void
test_reverse_rvalue_iterator
()
29
{
30
for
(
auto
e:
tpf::reverse
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
31
{
32
std::cout
<< e <<
", "
;
33
}
34
}
35
36
int
main
()
37
{
38
39
test_reverse_iterator
();
40
41
// test_reverse_rvalue_iterator();
42
}
cout
auto & cout
Definition:
044-functional.cpp:3
stream
tpf::sstream stream
Definition:
054-iterator.cpp:3
endl
auto endl
Definition:
054-iterator.cpp:4
test_reverse_rvalue_iterator
void test_reverse_rvalue_iterator()
Definition:
054-iterator.cpp:28
test_reverse_iterator
void test_reverse_iterator()
Definition:
054-iterator.cpp:6
main
int main()
Definition:
054-iterator.cpp:36
tpf::output::string_stream
Definition:
tpf_output.hpp:844
tpf::reverse
decltype(auto) reverse(ContainerType &&container)
Definition:
tpf_types.hpp:7959
tpf::endl
constexpr auto endl
Definition:
tpf_output.hpp:973
tpf_output.hpp
Stream output operators << are implemented.
CppExtension
examples
054-iterator.cpp
Generated by
1.9.4