On 07/12/2013 06:19 PM, Larry Evans wrote:
How could type TypeErasure library be used to attach concepts analogous to xml_serializer and book_data to a mixin::object which has been mutated as above? (BTW, I don't see a real use for this; however, I'm just trying to get a better understanding of the relationship between the two libraries).
I don't think that's possible. TypeErasure's concepts work with template functions that either compile or don't compile for a specific type. The mixin objects in Boost.Mixin as a C++ type have almost nothing. The object's messages (methods) that become available when you add some mixins to it are dynamically bound. You cannot have compile time checks about the mixins that comprise an object. Only runtime checks. Calling a message on a boost::mixin object ALWAYS compiles. If the message is not available there will be a runtime error instead. Of course you CAN have TypeErasure concepts for the actual methods of boost::mixin::object like `has`, `get`, `implements`, but I don't think that's very useful. Since TypeErasure provides primarily compile time features, and Boost.Mixin provides almost exclusively runtime features, I don't think you can combine the power of both libraries to do something cool (like calling Captain Planet :D) -- Borislav