On Friday, 28 April 2017 at 22:11:30 UTC, H. S. Teoh wrote:
On Fri, Apr 28, 2017 at 05:11:29PM -0400, Nick Sabalausky
(Abscissa) via Digitalmars-d-announce wrote:
On 04/28/2017 04:26 PM, Atila Neves wrote:
> The other day I was reminded that in C++ land one has to
> manually write `operator<<` to print things out and
> `operator==` to compare things.
Not to mention you have to overload operator<, operator!=,
operator==, operator>, operator<=, *and* operator>= in order to
get the right results in all cases.
In D, you have to overload opEquals and opCmp. Hmm, I wonder
why I enjoy programming in D more than C++...
Comparison is better in C++. This is a weak spot in D. You could
do the same in C++ as D if you wanted to. You can detect the
presence of operator< in overload templates, but being explicit
is not much work and more flexible. Just cut'n'paste the set you