C++ guys hate static_if?

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Mar 12 00:10:13 PDT 2013


On 3/12/13, deadalnix <deadalnix at gmail.com> wrote:
> Concepts are for instance THE perfect match for all kind of range
> we have.

I don't know about that. Consider that with template parameters and
static if you can pick and choose which range type you will implement:

struct Range(Store)
{
    static if (hasLength!Store)
    {
        // implement length, make the range random-access
    }
    else
    {
        // make the range an input range
    }
}

How would you implement this with concepts if you have to put the list
of implements at the struct header?


More information about the Digitalmars-d mailing list