Daniel Lemire·02 November 2026·1 min read
In C++, = default and {} are not the same constructor
You can write an empty default constructor as span() = default or as span() {}. It can have remarkable effects on performance.
tech
You can write an empty default constructor as span() = default or as span() {}. It can have remarkable effects on performance. struct span { const char *p; int len; const char *end; span() = default; // or span() {} span(const char *s, int n) : p(s), len(n), end(s + n) {} }; The constructor Continue reading In C++, = default and {} are not the same constructor
Reproduced from the Daniel Lemire feed. No model was used to write this entry — follow the link for the full article.