简体   繁体   中英

static sized valarray implementation

I am looking for a static-sized std::valarray implementation.

It should be easy to implement it by myself, but I need constexpr operations (sum,subtraction, etc.) and that is kinda boring/error prone to do, so I ask here if there is a popular implementation out there.

If I have to implement this by myself, do you think that expression-templates are worth in this case?

What about array of C++11 ?

But you have to implement the arithmetics yourself. Is that error-prone? I don't think so. Boring, maybe. And what about goo' ol' valarray from C++99 ? There you have your arithmetics, already -- but, alas, they are not constexpr .

But you can take its implementation, wrap it around a simple array specialization and and you have a less error-prone, exciting task ;-)

I myself would love to try it with expression templates. But it depends how quick you have to get the code on the road. Its probably difficult to do at first, but easier to maintain (for yourself and other template magicians) in the long run. And more fun.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM