While spelunking through the code of a new project you recently joined, you find the following factory function declaration:
widget* load_widget( widget::id desired );
1. What’s wrong with this return type?
2. What is the recommended return type? Explain your answer, including any tradeoffs.
3. You’d like to actually change the return type to match the recommendation in #2, but at first you worry about breaking source compatibility with existing calling code; recompiling existing callers is fine, but having to go change them all is not. Then you have an “aha!” moment, realizing that this is a fairly new project and all of your calling code is written using modern C++ idioms, and you go ahead and change the return type without fear, knowing it will require few or no code changes to callers. What makes you so confident?