Mach7 icon indicating copy to clipboard operation
Mach7 copied to clipboard

Support of boost::any is currently incorrect

Open solodon4 opened this issue 11 years ago • 1 comments

Current adaptation for boost::any is wrong. The problem is that currently XTL still keeps the same assumption that the polymorphic implementation does: the offsets within objects of the same class must remain constant. This happens because Mach7 simply saves the offset to reapply it on other objects of the same type. With boost::any there is no such guarantee (since heap part is not at fixed offset with respect to the main boost::any object). Even with boost::variant it is possible to do heap-based implementation that would violate this, but the one in boost right now seem to satisfy the requirement.

This is not an unsolvable problem though (see bullet 4 of issue #6): we plan to have an adaptor for classes that don’t satisfy this requirement that would let users implement a slower, but type-safe cast once the subtyping relation was established with the Match statement (e.g. via the address of typeid).

solodon4 avatar Jan 12 '15 08:01 solodon4

Checking in on this front as well.

elfprince13 avatar Nov 21 '19 03:11 elfprince13