37 stream <<
"\n--- Apply operations to std::array and std::tuple --- " <<
endL;
39 stream <<
"1. std::apply_operation(operation, tuple) - NON-INPLACE operation" <<
endL;
40 stream <<
"\tApply operation to elements of tuple." <<
endl;
41 stream <<
"\tThe argument tuple is NOT modified after operation." <<
endl;
42 stream <<
"\tA new instance of std::tuple is Created and Returned to its caller." <<
endL;
44 stream <<
"2. std::apply_operation_inplace(operation, tuple) - INPLACE operation" <<
endL;
45 stream <<
"\tApply operation to elements of tuple." <<
endl;
46 stream <<
"\tThe argument tuple is MODIFIED after operation." <<
endL;
48 stream <<
"3. std::apply_operation(operation, array) - NON-INPLACE operation" <<
endL;
49 stream <<
"\tApply operation to elements of array." <<
endl;
50 stream <<
"\tThe argument array is NOT modified after operation." <<
endl;
51 stream <<
"\tA new instance of std::array is Created and Returned to its caller." <<
endL;
53 stream <<
"4. std::apply_operation_inplace(operation, array) - INPLACE operation" <<
endL;
54 stream <<
"\tApply operation to elements of array." <<
endl;
55 stream <<
"\tThe argument array is MODIFIED after operation." <<
endL;
60 stream <<
"--- Apply Batch Operation to Tuple Elements---" <<
endL;
62 std::tuple a{1, 2.4, 4};
64 stream<<
"1. Apply Element-Wise Operation to SIMPLE Tuple - std::apply_operation(operation, tuple)" <<
endL;
68 stream <<
" WARNING: does CREATE a new type!!" <<
endL;
76 stream<<
"2. Apply Element-wise IN-PLACE Operation to SIMPLE Tuple - std::apply_operation_inplace(operation, tuple)" <<
endL;
77 stream <<
" WARNING: does NOT create a new type!!" <<
endL;
86 stream <<
" !! WARNGING !! sin(1) == sin(4) == 0, because 1 and 4 are integral types" <<
endL;
88 stream<<
"3. Apply Element-wise Operation to Nested Tuple - std::apply_operation(operation, tuple)" <<
endL;
90 std::tuple b{1.5, std::tuple{1, 2.4, 4}, std::tuple{1, 2.4, std::tuple{3.5, 5.6} } };
97 stream <<
" WARNING: a new type is created!!" <<
endL;
99 stream<<
"4. Apply Element-wise IN-PLACE Operation to Nested Tuple - std::apply_operation_inplace(operation, tuple)" <<
endL;
100 stream <<
" WARNING!! does NOT create a new type!!" <<
endL;
102 std::tuple c{1, std::tuple{2, 2.4, 4.3}, std::tuple{3, 2.4, std::tuple{3.5, 5.6} } };
111 stream <<
" WARNING!! does NOT create a new type!!" <<
endL;
113 stream <<
" !! WARNGING !! sin(1) == sin(2) == sin(3) == 0, because 1, 2, and 3 are integral types" <<
endL;
118 stream <<
"--- Apply Batch Operation to Array Elements ---" <<
endL;
120 stream<<
"0. WARNING!! The types of the elements of a std::array should be IDENTICAL!!" <<
endL;
122 std::array a{1, 2, 3};
124 stream<<
"1. Apply Operation to SIMPLE, Not Nested array - std::apply_operation(lambda, a)" <<
endL;
126 stream <<
" WARNING: namespace std - does create a new type" <<
endL;
136 stream <<
" WARNING: a new type is created in the above!!" <<
endL;
138 stream<<
"2. Apply Operation IN-PLACE to array - std::apply_operation_inplace(lambda, a)" <<
endL;
139 stream<<
" WARNING: New type is not created!" <<
endL;
148 stream <<
" !! WARNGING !! sin(1) == sin(2) == sin(3) == 0, because 1, 2, and 3 are integral types" <<
endL;
150 stream<<
"3. Apply Operation to Nested Array - std::apply_operation(lambda, b)"<<
endL;
152 std::array b{ std::array{1, 2, 3}, std::array{4, 5, 6} };
159 stream <<
" WARNING: a new type is created!!" <<
endL;
161 stream<<
"4. Apply IN-PLACE Operation to Nested Array - std::apply_operation_inplace(lambda, c)"<<
endL;
163 std::array c{ std::array{1.2, 2.4, 3.5}, std::array{4.3, 5.6, 6.2} };
165 stream <<
" Before std::array c = " << c <<
endL;
171 stream <<
" WARNING: std::array c is modified!!" <<
endL;
173 stream <<
"\t\t--- By Thomas Kim, Feb. 05, 2020. ---" <<
endl;
void test_apply_operation_to_tuple()
void summary_apply_binary_operation_to_array_tuple()
void test_apply_operation_to_array()
auto apply_operation(OperationType &&operation, const std::tuple< ArgTypes... > &tuple)
void apply_operation_inplace(OperationType &&operation, std::array< T, Size > &array)
Type to string name conversions are defined.
Stream output operators << are implemented.
Type functions are implemented.