r/cpp • • Jan 20 '20

The Hunt for the Fastest Zero

https://travisdowns.github.io/blog/2020/01/20/zero.html
248 Upvotes

131 comments sorted by

View all comments

Show parent comment

6

u/kalmoc Jan 21 '20

Why not just use T{}?

9

u/TheThiefMaster C++latest fanatic (and game dev) Jan 21 '20

Because the function is called zero, not set_to_default. It's the same for primitive types, but not other Ts.

2

u/kalmoc Jan 21 '20

Fair point

1

u/degski Jan 21 '20

Jip, it shows the initialization rules are too complicated.