Closed krzikalla closed 4 weeks ago
Hi, Here is a minimal example of copying data members https://godbolt.org/z/17rWE5MxG
Thanks for the quick reply. Thus the trick is to use expand and a templatized create_type function instead of the iterative approach shown in example §3.10 (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2996r5.html#struct-to-struct-of-arrays). Now it works:
Great that you managed to fix your code :) I am still puzzled about what the code does exactly though xD
It mimics the data member access operator (operator.
). Eventually the expression data[i].x
will return a std::simd
value. For more details you might refer to my cppcon24 talk (github doesn't let me send private messages, but you will find it, my name is rather specific).
Oh, so this is a piece of puzzle i was missing to see a reason to have a layer of misdirection in data access, will definitely have a look at your talk once it will be online :) Will be happy to look at the final result, as well. Also, are you considering different memory layouts for aligned loading inside simd?
@krzikalla Sounds like you figured out how to achieve what you're trying to achieve - Is there still an issue, or should we close this one?
Can be closed, thank you.
I wonder whether this is the right place to ask questions about your reflections approach. Sorry, if this is the wrong place. Anyway... I am trying to create a struct, which mirrors the non-static data members of another struct. Those reflected data member have special types. Such a type should allow me to access the original data member, when it gets an object to the original struct. You find my experiments here:
https://godbolt.org/z/bEvr1eW9x
My code always fails in substitute. IMHO the most promising approach is
But substitute "dereflects"
member
expression. Writing^member
in thesubstitute
call doesn't help:error: non-type template argument is not a constant expression
. Do I have a chance to reach my goal with the current reflection implementation?