D's Destructors are What Scott Meyers Warned Us About
sarn
sarn at theartofmachinery.com
Sun May 27 21:56:31 UTC 2018
On Sunday, 27 May 2018 at 21:11:42 UTC, 12345swordy wrote:
> On Sunday, 27 May 2018 at 18:55:41 UTC, Mike Franklin wrote:
>> And see this talk for a demonstration of the benefits
>> https://www.youtube.com/watch?v=endKC3fDxqs
>>
>> Mike
>
> Can you actually reply to me instead of saying "read/watch
> this"? I'm not going to watch an hour, just to see how you
> going to achieve this.
tl;dw: there's precedent. Historically typeinfo has been
overused in the runtime library (I think it's because a lot of
the code/architecture predates today's templates). For example,
if you compared an int[] to an int[], the compiler would generate
a function that looked up a comparator for int using RTTI, and
would iterate over the arrays calling it on each element. That
video is about replacing code like that with smarter templated
code that's not only faster but results in *less* code bloat.
More information about the Digitalmars-d
mailing list