In C++, = default and {} are not the same constructor (opens external site)
View full thread · View on Hacker News
To get push notifications on iPhone or iPad, add Hack and Chat to your Home Screen: tap Share → Add to Home Screen, then open the installed app and enable push in Settings.
View full thread · View on Hacker News
In JavaScript, how do you use new Array(...) to create an array consisting of a single integer? You can do the same with a single value of any other type.
The reason these languages don't have the make_unique or emplace problems is because they don't have a concept of in-place construction at all, since objects in those languages are heap-allocated and have reference semantics anyway.
Replies (2)
More importantly, you have exactly the same problem if you overload a regular method that way. So it’s a problem with overloading, not with constructors.
> How do you construct a MyVector of two items?
The correct solution, of course, is to provide named static constructor methods instead (e.g. `MyVector.ofRange(start, end)`).I do agree that support for named actual constructor methods would be nice. But they would still be constructors.