On Monday, 1 August 2016 at 16:09:50 UTC, Alex wrote:
On Monday, 1 August 2016 at 15:51:58 UTC, Jonathan M Davis wrote:
template isIndexable(I, T)
{
    enum isIndexable = __traits(compiles, T.init[I.init]);
}

As a last question afterwards:
Is it possible to create such an isIndexable template without templating over the type T?
something like

template isIndexable(I)
{
    enum isIndexable = __traits(compiles, ???[I.init]);
}

sure, I could use

__traits(compiles, (int[]).init[I.init])

but is this the intended way to go?

Reply via email to