15 using name_t = std::string;
17 using weight_t = double;
23 using value_type =
typename container_t::value_type;
27 container_t container;
29 container.emplace_back(
"Thomas Kim");
30 container.emplace_back(19);
31 container.emplace_back(22.0 /7.0);
32 container.emplace_back(30);
33 container.emplace_back(21.0 /7.0);
34 container.emplace_back(
"James Park");
54 stream <<
"Weight is " << weight <<
nl;
58 handle_elements.for_each(container);
61 handle_elements.for_each_reverse(container);
70 [&
stream, &
nl](
auto&& itr,
auto&& name)
74 stream <<
"Type of iterator: "
78 [&
stream, &
nl](
auto&& itr,
auto&& age)
82 stream <<
"Type of iterator: "
86 [&
stream, &
nl](
auto&& itr,
auto&& weight)
88 stream <<
"Weight is " << weight <<
nl;
90 stream <<
"Type of iterator: "
95 handle_elements_with_iterator.for_each_iterator(container);
102 [&
stream, &
nl, &container](
auto index,
auto&& name)
104 stream << index <<
" - Name is " << name <<
nl;
107 [&
stream, &
nl, &container](
auto index,
auto&& age)
109 stream << index <<
" - Age is " << age <<
nl;
112 [&
stream, &
nl, &container](
auto index,
auto&& weight)
114 stream << index <<
" - Weight is " << weight <<
nl;
118 handle_elements_with_index.for_each_index(container);
121 handle_elements_with_index.for_each_reverse_index(container);
124 handle_elements_with_index.for_each_index(
types::reverse(container));
127 for(
auto& vt: container)
147 using name_t = std::string;
149 using weight_t = double;
155 using value_type =
typename container_t::value_type;
159 container_t container;
161 container.emplace(
"Thomas Kim");
162 container.emplace(19);
163 container.emplace(22.0 /7.0);
164 container.emplace(30);
165 container.emplace(21.0 /7.0);
166 container.emplace(
"James Park");
186 stream <<
"Weight is " << weight <<
nl;
190 handle_elements.for_each(container);
193 handle_elements.for_each_reverse(container);
202 [&
stream, &
nl](
auto&& itr,
auto&& name)
206 stream <<
"Type of iterator: "
210 [&
stream, &
nl](
auto&& itr,
auto&& age)
214 stream <<
"Type of iterator: "
218 [&
stream, &
nl](
auto&& itr,
auto&& weight)
220 stream <<
"Weight is " << weight <<
nl;
222 stream <<
"Type of iterator: "
227 handle_elements_with_iterator.for_each_iterator(container);
234 [&
stream, &
nl, &container](
auto index,
auto&& name)
236 stream << index <<
" - Name is " << name <<
nl;
239 [&
stream, &
nl, &container](
auto index,
auto&& age)
241 stream << index <<
" - Age is " << age <<
nl;
244 [&
stream, &
nl, &container](
auto index,
auto&& weight)
246 stream << index <<
" - Weight is " << weight <<
nl;
250 handle_elements_with_index.for_each_index(container);
253 handle_elements_with_index.for_each_reverse_index(container);
256 handle_elements_with_index.for_each_index(
types::reverse(container));
259 for(
auto& vt: container)
278 using name_t = std::string;
280 using weight_t = double;
282 using vctr_t = std::vector<name_t>;
291 using value_type =
typename container_t::value_type;
295 container_t container;
297 container.emplace_back(
"Thomas Kim");
298 container.emplace_back(19);
299 container.emplace_back(22.0 /7.0);
300 container.emplace_back(vctr_t{
"Sophie Turner",
"Robert Park",
"The Programmer"} );
301 container.emplace_back(30);
302 container.emplace_back(21.1 /7.0);
303 container.emplace_back(
"James Park");
304 container.emplace_back(vctr_vt_t{ 1, 2, 3, 1.5, 2.3, 4.6 } );
326 stream <<
"Weight is " << weight <<
nl;
340 stream <<
"vctr_vc_t - age: " << age <<
nl;
345 stream <<
"vctr_vc_t - weight: " << weight <<
nl;
352 handle_elements.for_each(container);
359 using key_t =
const char*;
360 using name_t = std::string;
362 using weight_t = double;
364 using list_t = std::list<std::string>;
369 container_t container;
371 container[
"Programmer"] =
"Thomas Kim";
372 container[
"Age"] = 19;
373 container[
"Weight"] = 61.5;
375 container[
"Friend"] =
"Sophie Turner";
376 container[
"Her Age"] = 17;
377 container[
"Her Weight"] = 55.5;
379 container[
"Old Buddies"] =
list_t{
"James",
"Amie",
"Robert",
"Michelle"};
386 [&
stream, &
nl](
auto&& key,
auto&& list)
398 [&
stream, &
nl](
auto&& key,
auto&& name)
400 stream << key <<
" is " << name <<
nl;
403 [&
stream, &
nl](
auto&& key,
auto&& age)
405 stream << key <<
" is " << age <<
nl;
408 [&
stream, &
nl](
auto&& key,
auto&& weight)
410 stream << key <<
" is " << weight <<
nl;
415 visitors.for_each(container);
419 visitors.for_each_reverse(container);
423 for(
auto& vt: container)
432 [&
stream, &
nl](
auto&& itr,
auto&& key,
auto&& list)
443 stream <<
"In the list: " << list <<
nl;
448 [&
stream, &
nl](
auto&& itr,
auto&& key,
auto&& name)
450 stream << key <<
" is " << name <<
nl;
455 [&
stream, &
nl](
auto&& itr,
auto&& key,
auto&& age)
457 stream << key <<
" is " << age <<
nl;
462 [&
stream, &
nl](
auto&& itr,
auto&& key,
auto&& weight)
464 stream << key <<
" is " << weight <<
nl;
470 visitors_with_iterator.for_each_iterator(container);
478 using key_t =
const char*;
479 using name_t = std::string;
481 using weight_t = double;
483 using list_t = std::list<std::string>;
493 container_t container;
495 container[
"Programmer"] =
"Thomas Kim";
496 container[
"Age"] = 19;
497 container[
"Weight"] = 61.5;
499 container[
"Friend"] =
"Sophie Turner";
500 container[
"Her Age"] = 17;
501 container[
"Her Weight"] = 55.5;
503 container[
"Old Buddies"] =
list_t{
"James",
"Amie",
"Robert",
"Michelle"};
510 [&
stream, &
nl](
auto&& key,
auto&& list)
522 [&
stream, &
nl](
auto&& key,
auto&& name)
524 stream << key <<
" is " << name <<
nl;
527 [&
stream, &
nl](
auto&& key,
auto&& age)
529 stream << key <<
" is " << age <<
nl;
532 [&
stream, &
nl](
auto&& key,
auto&& weight)
534 stream << key <<
" is " << weight <<
nl;
539 visitors.for_each(container);
547 for(
auto& vt: container)
556 [&
stream, &
nl](
auto&& itr,
auto&& key,
auto&& list)
567 stream <<
"In the list: " << list <<
nl;
572 [&
stream, &
nl](
auto&& itr,
auto&& key,
auto&& name)
574 stream << key <<
" is " << name <<
nl;
579 [&
stream, &
nl](
auto&& itr,
auto&& key,
auto&& age)
581 stream << key <<
" is " << age <<
nl;
586 [&
stream, &
nl](
auto&& itr,
auto&& key,
auto&& weight)
588 stream << key <<
" is " << weight <<
nl;
594 visitors_with_iterator.for_each_iterator(container);
void test_vector_of_variant_with_vector()
void test_map_of_variants()
void test_unordered_map_of_variants()
void test_vector_of_variants()
void test_set_of_variants()
constexpr auto reverse(sequence< ms... > mm, sequence< rs... >)
Type to string name conversions are defined.
hidden::vector_of_variants_t< ElementTypes... > vector_of_variants_t
hidden::map_of_variants_t< KeyType, ElementTypes... > map_of_variants_t
hidden::set_of_variants_t< ElementTypes... > set_of_variants_t
variant_visitors< remove_cv_ref_t< CallbackTypes >... > make_variant_visitors(CallbackTypes &&... visitors)
hidden::unordered_map_of_variants_t< KeyType, ElementTypes... > unordered_map_of_variants_t
hidden::container_of_variants_t< ContainerType, ElementTypes... > container_of_variants_t
Stream output operators << are implemented.
#define Tpf_GetTypeName(type_arg)
A macro that returns type_arg's string name.
#define Tpf_GetTypeCategory(instance_arg)
A macro that returns instance_arg's type category string name.