What about array C ++ 11 ?
But you must implement arithmetic yourself. Is it error prone? I do not think so. Maybe boring. What about goo 'ol' valarray from C ++ 99 ? There you already have your arithmetic, but, alas, they are not constexpr .
But you can take its implementation, wrap it around the simple specialization of array , and you have a less error-prone, exciting task; -)
I would really like to try it with expression templates. But it depends on how fast you have to get the code on the road. It is probably hard to do at first, but easier to maintain (for yourself and other wizards) in the end. And more fun.
source share