Would be nice to just have this_return_value as a first-class construct in functions, as Pascal has supported all along.
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Not bad, though you have to add that constructor to every type you want to init this way. C++17 has guaranteed copy elision, so this trick isn't really needed anymore.
-
Let's say you want to construct an optional<tuple<ts...>> from a tuple<us...>, performing some sort of conversion and test on each element, with the optional's has_value true only if all tests succeed. How would you do this without exceptions or extra copies?
- 8 more replies
New conversation -
-
-
What exactly is the problem youre trying to solve here? You want the address of the object in the calling stack frame i.e. the final destination after copy elision / RVO? I'm not seeing how elision/RVO is guaranteed to happen
-
Aim: testing and transforming data on arbitrary nested data structures in a single pass, generating results once in-place, without throwing exceptions.
End of conversation
New conversation -
-
-
Is the return statement in the constructor supposed to be there? I thought it wasn't valid in C++ to return a value in a constructor.
-
You’re right. “return lambda(this);” should be “lambda(this);”
End of conversation
New conversation -
-
-
*cries into a Stroustroup book*
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Rewrite it in rust.
-
brb *looks for Michael Jackson eating popcorn meme*
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.