C++ Library Extensions
2022.12.09
To help learn modern C++ programming
058-array_wrapper.cpp
Go to the documentation of this file.
1
#include <
tpf_output.hpp
>
2
3
tpf::sstream
stream
;
4
auto
endl
=
tpf::endl
;
5
auto
nl
=
tpf::nl
;
6
7
namespace
types
=
tpf::types
;
8
9
void
test_array_wrapper
()
10
{
11
int
array[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
12
double
darray[] {0.0, 1.0, 1.3};
13
14
tpf::types::array_wrapper_t
wapper{array};
15
16
auto
& [pointer, size] = wapper;
17
18
stream
<< wapper <<
endl
;
19
20
stream
<<
tpf::types::array_wrapper
(array) <<
endl
;
21
22
stream
<<
tpf::types::array_wrapper
(darray) <<
endl
;
23
24
auto
msg1 =
"I love it"
;
25
auto
& msg2 =
"What?"
;
26
auto
v =
tpf::make_vector
(array);
27
28
stream
<< v <<
endl
;
29
30
stream
<<
tpf::types::array_wrapper
(array) <<
endl
;
31
}
32
33
int
main
()
34
{
35
test_array_wrapper
();
36
}
test_array_wrapper
void test_array_wrapper()
Definition:
058-array_wrapper.cpp:9
stream
tpf::sstream stream
Definition:
058-array_wrapper.cpp:3
endl
auto endl
Definition:
058-array_wrapper.cpp:4
nl
auto nl
Definition:
058-array_wrapper.cpp:5
main
int main()
Definition:
058-array_wrapper.cpp:33
tpf::output::string_stream
Definition:
tpf_output.hpp:844
tpf::types
Type to string name conversions are defined.
Definition:
31-visit.cpp:7
tpf::types::array_wrapper
auto array_wrapper(ElementType(&array)[ElementSize]) noexcept
Definition:
tpf_types.hpp:1228
tpf::make_vector
decltype(auto) make_vector(Type &&arg, Types &&... args)
Definition:
tpf_types.hpp:7911
tpf::endl
constexpr auto endl
Definition:
tpf_output.hpp:973
tpf::nl
constexpr auto nl
Definition:
tpf_output.hpp:971
tpf::types::array_wrapper_t
Definition:
tpf_types.hpp:1215
tpf_output.hpp
Stream output operators << are implemented.
CppExtension
examples
058-array_wrapper.cpp
Generated by
1.9.4