pointers inside arbb space?

pointers inside arbb space?

Hello all
I'm just figuring out how to implement a multi-column, multi-type data structure. There are about five types (known at compile-time) and each column can have a different one. 
The number of columns and the type for each column is available at runtime only. 
2-dim dense containers or a combination of dense containers inside nested containers doesn't fit well. There will be added sophisticated operations on these data structures later. 
Is any "pointering" inside arbb space/custom types possible? I already tried to, but something like "new dense" doesn't compile. 
Thanks in advance
Tobias Mueller
4 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Why not create a multidimentional dense container of structs? Check out the section in the User's Guide on custom types. You can create dense containers around those, assuming that each of the individual items are arbb types like i32, etc. There should be some initial examples in there that you can get to compile/run and then modify as you see fit.

Thanks for your response. 
Structs are something I haven't considered yet - but I see a big issue: The column count/types of a vector are unknown at compile-time. 
Let's look at this example vector: 
( 1, 1.0, true)
( 2, 2.0, false)
( 3, 3.0, true)
( 4, 4.0, false)
( ...
With a struct I can model single rows: 
struct my_row {
i64 value1;
f64 value2;
bool value3;
And then put these into a variable-sized dense container: 
dense my_vector = dense(size);
The problem I have is: struct types can't be declared at runtime. Maybe there is another vector which has only two columns. Or another which has 200 columns. This information is available at runtime only. 
You also mentioned multidimensional containers (two-dimensional would be enough here). I don't think they help. I do need different types for different columns. Multi-dim containers offer only one type for all elements. Right? 
Tobias Mueller

I found the perfect explanation for your questions here. 


My best recommendation would be to read through the User-Defined types section and model your code based on the sample. They have an entire struct-based user-defined type written out that you can modify to suit your needs. Also make sure to read on how to declare a function on the type so that it is processed in parallel. It's easy to mess up the function declaration and then it ends up running serial or incur a runtime error.

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo