Why is Boost.Any an application of the Adapter pattern? Who would be the Adaptee? I'm confused. Thanks!
Asked
Active
Viewed 53 times
1 Answers
1
Who claims as much? An adaptor "adapts" the public interface to another. Arguably, Any just removes the interfaces "hiding" it.
Of course a minimum interface is substituted that allows users to recover the "original", underlying interface.
But I wouldn't call that adaptation. For adaptation, I'd expect to have a useful interface indirectly mapped onto another interface implementation.
Oh, and in
boost::any any = std::string("hello world");
the std::string
object would be the adaptee. But that's presuming that you agree that it "adapts" the string to an "any" interface

sehe
- 374,641
- 47
- 450
- 633