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,941
  • 1
  • 24
  • 39

0 Answers0