On Saturday, 20 February 2016 at 17:22:49 UTC, Mike Parker wrote:
On Saturday, 20 February 2016 at 17:20:16 UTC, Mike Parker
wrote:
getValue();
It's not unusual to discard the return value when calling a
function. Though a getter isn't a good example of this, of
course.
Oops. I somehow
On Saturday, 20 February 2016 at 17:20:16 UTC, Mike Parker wrote:
getValue();
It's not unusual to discard the return value when calling a
function. Though a getter isn't a good example of this, of
course.
Oops. I somehow had it in my head that your example function was
getValue(), rather
On Saturday, 20 February 2016 at 15:47:27 UTC, Jeremy DeHaan
wrote:
With the case of auto of course there is ambiguity, you don't
know which one to pick. In my example there should have been no
ambiguity at all as only one of the overloads would actually
compile. That is what confuses me and
On Sat, 20 Feb 2016 15:47:27 +, Jeremy DeHaan wrote:
> If there are multiple overloads that have the same number of parameters,
> a very simple addition to the rules of function overloading would be
> "does it compile?" If only one overload compiles, use it. If more than
> one compile, there
On Saturday, 20 February 2016 at 12:29:21 UTC, Jonathan M Davis
wrote:
On Saturday, February 20, 2016 03:24:45 Jeremy DeHaan via
Digitalmars-d-learn wrote:
snip
I'm unaware of any language that takes the return type into
account when overloading. The type the expression test.thing()
has to
On Saturday, February 20, 2016 03:24:45 Jeremy DeHaan via Digitalmars-d-learn
wrote:
> module main;
>
> struct ThingOne
> {
> int thing = 1;
> }
>
> struct ThingTwo
> {
> float thing = 2;
> }
>
>
> struct Test
> {
>ThingOne thing()
> {
>return ThingOne();
> }
>
>
module main;
struct ThingOne
{
int thing = 1;
}
struct ThingTwo
{
float thing = 2;
}
struct Test
{
ThingOne thing()
{
return ThingOne();
}
ThingTwo thing()
{
return ThingTwo();
}
}