Consider the following code:In the case of forwarding the whole struct I would do std::forward<T>(some_struct). But how do I get the correct type when forwarding a member?
I came up with the following code to transform a R()-like into a void()-like callable:I'm worried about the capture by reference.
My compiler is clang 7.0 with -std=c++17.Why doesn't universal reference apply for arrays?First of all, these are officially called "forwarding references", not "universal references".
Looking at the documentation for std::forward,Both functions return T&&, which (correct me if I'm wrong) collapses to
I have an annoying scenario where I need to defer the initialization of some object state and allow the user to construct one on demand. E.g.