Blog Post: Beating std::visit Without Really Trying

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Oct 7 01:09:34 UTC 2019


On 10/6/19 3:09 AM, Joseph Rushton Wakeling wrote:
> You misunderstand what I mean by "battle-testing". Clearly designs 
> should go through a high level of testing and usage before they go 
> anywhere near the standard library. But the very fact of being placed in 
> the standard library exposes them to orders of magnitude more usage, and 
> hence gives a much stronger guarantee of establishing their correctness 
> (or identifying their flaws).

Well also in the case of SumType there's not even much battle-testing. 
It's more of an implementation than a design. Take the existing variant, 
keep the interface, remove the cruft, put in the new nice code. Make it 
pass the unittests, and release. Of course it's an involved process, but 
definitely not more difficult than writing the new code to start with. 
The author receives credit as the primary author of the facility. It is 
wonderful service to the community - not only offers better speed for 
new code, but it instantly enhances speed of existing variant uses.


More information about the Digitalmars-d-announce mailing list