Operator Overloading with multiple return types

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Mar 15 23:39:19 UTC 2019


On Fri, Mar 15, 2019 at 04:29:22PM -0700, Ali Çehreli via Digitalmars-d-learn wrote:
> On 03/15/2019 03:48 PM, H. S. Teoh wrote:
[...]
> > Ali's example was unfortunately deceptively formatted.
> 
> My editor did that. :)

This is why I don't trust auto-formatters. ;-)


> On my work computer, I've been experimenting with pulling the 'if',
> 'in', etc to the same level as the function signature:
> 
>   int foo(T)(T t)
>   if (isBlah!T)
>   in (!t.empty) {
>     // ...
>   }
[...]

Phobos style also dictates that:

	int foo(T)(T t)
	if (isBlah!T)
	in (!t.empty)
	{
		...
	}

In my own code, however, I find it too block-of-text-y, so I prefer to
indent it inwards:

	int foo(T)(T t)
		if (isBlah!T)
		in (!t.empty)
	{
		...
	}

But if your style puts { at the end of the line rather than the
beginning, this could make it even easier to confuse for a statement
inside the body.

So YMMV.


T

-- 
IBM = I'll Buy Microsoft!


More information about the Digitalmars-d-learn mailing list