Struct default constructor - need some kind of solution for C++ interop

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 7 17:30:25 PDT 2016


On 9/7/2016 4:05 PM, deadalnix wrote:
>> And with a default constructor, there's all that code added to deal with the
>> constructor failing and throwing.
> One needs to construct anyway.

For constructor failures, one has little choice but to throw an exception. 
Despite all the great work at making exceptions zero-cost for the non-throwing 
path, they aren't zero-cost.

With a 'builder()', there are options other than throwing an exception, if 
performance is the top priority.



More information about the Digitalmars-d mailing list