From Jason Turner
Watch on YouTube

Summary

This episode addresses a subtle but potentially serious API design issue with nested types that both provide similar methods. Jason demonstrates how calling value.reset() on a smart pointer containing a type like std::any can lead to ambiguity - are you resetting the pointer itself or the contained object? This ambiguity can lead to undefined behavior when a developer intends one reset operation but inadvertently performs the other, with no compiler diagnostics to catch this design flaw.

Resources

Tags