Can we make Throwable an interface?

Lars T. Kyllingstad via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 11 08:35:39 PST 2014


On Thursday, 11 December 2014 at 15:04:53 UTC, Jacob Carlborg
wrote:
> On 2014-12-11 08:21, Lars T. Kyllingstad wrote:
>
>> I'm not sure what is the best way to achieve this in D, but 
>> one option is to use
>> an (associative?) array of Variants.
>
> How does Boost implement this?

Classes that contain the additional information must inherit
boost::error_info, and each exception contains a map<type_info,
shared_ptr<error_info>>. We could do more or less the exact same
thing in D, of course, with ErrorInfo[TypeInfo], or even
Object[TypeInfo], but I think I'd prefer a non-polymorphic
solution.


More information about the Digitalmars-d mailing list