On 3/13/15 8:56 AM, Christophe B. wrote:
Hi all,
I want to construct a static const vector being the result of concatenation of two other vectors. I was thinking to use boost::push_back, but it takes a container as a lvalue reference as a 1st argument. I could develop the following piece of code
template
Container concat(Container const &c, Range cont& r) { Container result = c; return boost::push_back(result, r); } static const std::vectorstd::string v = concat(v1, v2);
But I wanted to avoid to reinvent the wheel. Currently, I am living with this kind of writing:
static const auto v = [&]{ std::vectorstd::string result = v1; return boost::push_back(result, v2); }();
Does boost libraries offer a better alternative to this construct ?
Christophe
Something like this:
using namespace boost;
std::vectorstd::string v
= copy_range