Attribute inference for auto functions?

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Apr 17 03:16:38 PDT 2013


On 4/17/13, Jesse Phillips <Jessekphillips+d at gmail.com> wrote:
> How frequently do you write a non-templated function which
> returns a complex template type?

This can be common if the function is a member function that returns
some kind of a range on internal data, for example:

import std.range;
struct S
{
    int[] arr;
    auto range() { return cycle(arr).stride(2); }
}

There's no need to make "range" a template here, but specifying the
return type isn't always possible or easy to do.


More information about the Digitalmars-d mailing list