"darkness"}, {"my", "old"}, {"friend"} };
since std::initialiser_list is tied with list-initialisation, the std::initializer_list<> constructor will be called and multiple vectors will be constructed in memory and copied over to the original vector.
but if they were not tied, then the pointers to the literals could be used to directly emplace_back() (which would cause emplace_back() on the subvectors too) the objects (maybe with std::forward() for recursion?). or they could be constructed as temporary, then moved over.
give me the code in compiler explorer that you are saying that doesn't gets copied over moved
Обсуждают сегодня