1

Consider the following code:

std::function<void()> bind_arg(int&& arg) {
    return [arg]() {
        std::cout << arg << std::endl;
    }
}

Does this code bind arg by value or by rvalue reference? (That is, is this safe, or does it bind a dangling reference?)

IanPudney
  • 5,747
  • 1
  • 21
  • 37

0 Answers0