Read this:
std::initializer_list - Cppreference

Get the sizes of the buffers to allocate by caling the size() function of the relevant lists.
And a for loop, with the iterators to copy.