I would like to implement a function that fills up a vector and then returns an rvalue reference. I tired something like:
std::vector &&fi
If you just remove the &&
from your function it should work, but it will not be a reference. fill_list() will create a vector and return it. During the return a new vector will be created. The first vector that was created inside fill_list() will be copied to the new vector and then will be destroyed. This is the copy constructor's work.