Boost logo

Boost :

Subject: Re: [boost] Proposal: boost::make_array()
From: Zoltán Tóth (zo1980_at_[hidden])
Date: 2013-01-16 07:06:10


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk