Šimon Tóth’s Post

View profile for Šimon Tóth

C++ Educational Content Creator | 20 years of Software Engineering experience distilled into digestible daily posts

Correctly forwarding the value category for a member of a compound type before C++23 was cumbersome. Forunately C++23 introduced the std::forward_like, which makes this operation a lot simpler. The std::forward_like is also essential when using the "deducing this" feature. Compiler Explorer link: https://lnkd.in/dS32w-6J #cpp #cplusplus #coding #programming #dailybiteofcpp

  • text

Not sure, but why can’t we just use: void extract4(auto&& wrapper) { fun(std::forward<decltype(wrapper)>(wrapper)); }

Hmm...why not using std::forward? Or it's a solution for functions ?

Like
Reply

It's a follow up for deduced this. It was already mentioned in the original proposal for deduced this.

See more comments

To view or add a comment, sign in

Explore content categories