The first container proposed by KIWAKU is kwk::view. kwk::view is a non-owning adapter that can be constructed from various type of data sources so you can manipulate them as a nD array-like entity. This page will go over the basic of constructing, configuring, accessing and computing over views
Let's start with a simple example:
After constructing a std::vector to holds some data, we can take a view over its data. To do so, we create a view instance. The definition of our view may look strange for multiple reasons:
v is constructed from named parameters instead of more traditional, positional parameters. The two parameters we use here are kwk::source to specify where the data are stored and kwk::of_size to specify the size of each dimensions of the view.Those API choices are very important for KIWAKU as we want to make the mental burden of remembering which parameter (type or value alike) come after which other or if any parameter has a potentially non-trivial default value. We'll go over each parameters as we continue this serie of tutorials.
Once done, we can just print the contents of the view. The result here should be:
Displaying data on the standard output is fine but, maybe, we want to do some actual work with our view.
In this first tutorial, we managed to:
In the next tutorial, we will take a look at kwk::table, the owning multi-dimensional container.