How do I remove code duplication between similar ref-qualified member functions?
问题 Similarly to How do I remove code duplication between similar const and non-const member functions?, I want to remove the code duplication between nearly identical member functions, except for ref qualifiers. Let's say I have a class that's something like this: class MyStringBuilder { std::string member; public: // Other functions std::string create() const& { // Some work std::string result = member; // More work return result; } std::string create() && { // Some work std::string result =