aboutsummaryrefslogtreecommitdiff
path: root/articles/2020-05-26_lambda_tuple_swallowing.md
diff options
context:
space:
mode:
authorAdrian Kummerlaender2020-05-26 18:29:21 +0200
committerAdrian Kummerlaender2020-05-26 18:29:21 +0200
commitba693d81b0d29eeb776a7eea2bdaf6206ceadc09 (patch)
tree926f473a571456fd72393924c1db0c8a32999a04 /articles/2020-05-26_lambda_tuple_swallowing.md
parentf2a1972f68dddf2cfd0dabe44c883a24351131a7 (diff)
downloadblog_content-master.tar
blog_content-master.tar.gz
blog_content-master.tar.bz2
blog_content-master.tar.lz
blog_content-master.tar.xz
blog_content-master.tar.zst
blog_content-master.zip
Fix typoHEADmaster
Diffstat (limited to 'articles/2020-05-26_lambda_tuple_swallowing.md')
-rw-r--r--articles/2020-05-26_lambda_tuple_swallowing.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/articles/2020-05-26_lambda_tuple_swallowing.md b/articles/2020-05-26_lambda_tuple_swallowing.md
index f64ea52..b33c046 100644
--- a/articles/2020-05-26_lambda_tuple_swallowing.md
+++ b/articles/2020-05-26_lambda_tuple_swallowing.md
@@ -1,6 +1,6 @@
# Working with tuples using swallowing and generic lambdas
-Suppose you have some kind of list of types. Such a list by can by itself be [used](/article/using_scheme_as_a_metaphor_for_template_metaprogramming/) to perform any compile time computation one might come up with. So let us suppose that you additionally want to construct a tuple from something that is based on this list. i.e. you want to connect the compile time only type list to a run time object. In such a case you might run into new question such as: How do I call constructors for each of my tuple values? How do I offer access to the tuple values using only the type as a reference? How do I call a function for each value in the tuple while preserving the connection to the compile time list? If such questions are of interest to you, this article might possibly also be.
+Suppose you have some kind of list of types. Such a list can by itself be [used](/article/using_scheme_as_a_metaphor_for_template_metaprogramming/) to perform any compile time computation one might come up with. So let us suppose that you additionally want to construct a tuple from something that is based on this list. i.e. you want to connect the compile time only type list to a run time object. In such a case you might run into new question such as: How do I call constructors for each of my tuple values? How do I offer access to the tuple values using only the type as a reference? How do I call a function for each value in the tuple while preserving the connection to the compile time list? If such questions are of interest to you, this article might possibly also be.
While the standard's tuple template is part of the C++ subset I use in basically all of my developments[^0] I recently had to revisit some of these questions while reworking OpenLB's core data structure using its [_meta descriptor_](/article/meta_descriptor/) concept. The starting point for this was a class template called `FieldArrayD` to store an array of instances of a single field in a SIMD vectorization friendly _structure of arrays_ layout. As a LBM lattice in practice stores not just one such field type but multiple of them (all declared in the central _descriptor_ structure) I then wanted a `MultiFieldArrayD` class template that does just that. i.e. a simple wrapper that accepts a list of fields as a variadic template parameter pack and instantiates a `FieldArrayD` for each of them. A sensible place for storing these instances is of course our trusty `std::tuple`: