
16 Jan
2013
16 Jan
'13
12:06 p.m.
I am an algorithm developer. I also created in my own library such a function. I am using it for years, and found it very useful in everyday work. These very simple tools really help a lot. But according to my experience it is crucial that you keep it simple, something like: template <typename Item, typename Array = std::array<Item, n>> Array make_array (const Item & i_1, const Item & i_2, ..., const Item & i_n) { Array a {{i_1, ..., i_n }}; return a; } Separate implementations for each n. I am afraid that any complication (like boost::assign, boost::common_type) causes more practical trouble (longer compile time, cryptic compiler error messages) than gain.