Suppose I have a class with the following constructor:
class Foo { Foo(std::initializer_list<uin8_t> args) { .... } }
and I have the following array: std::array<uint8_t, 6> bar .
Now I would like to create an off foo object with an array bar . Is there any other way to do this as follows:
Foo f (bar[0], bar[1], bar[2], bar[3], bar[4], bar[5]);
This method seems a bit complicated, and it looks like it's not the way it should be.
So, can I create a std::initializer list from an existing array without listing each element of the array?
c ++ arrays initializer-list
Ventu
source share