How do I remove code duplication between similar const and non-const member functions?

For a detailed explanation, please see the heading “Avoid Duplication in const and Non-const Member Function,” on p. 23, in Item 3 “Use const whenever possible,” in Effective C++, 3d ed by Scott Meyers, ISBN-13: 9780321334879. Here’s Meyers’ solution (simplified): struct C { const char & get() const { return c; } char & get() … Read more