Indexing with an arbitrary type
Alex via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 3 09:42:18 PDT 2016
On Wednesday, 3 August 2016 at 14:46:25 UTC, Alex wrote:
> On Wednesday, 3 August 2016 at 14:23:59 UTC, Jonathan M Davis
> wrote:
>
> But it should.
>
> Just found this:
> https://www.sgi.com/tech/stl/StrictWeakOrdering.html
> which should be fulfilled by a type, which can be used as a
> key. So, in my opinion, the property "being a key" is a matter
> of an abstract definition and should have nothing to do with
> objects which I want to index with it.
>
> Sure, the object which I want to index, has to define an
> opIndex method, which can receive the key-thing, but this is
> already the next step.
So, I think this is the answer to my question:
http://stackoverflow.com/questions/27282568/d-template-constraint-to-show-whether-a-given-type-is-comparable
More information about the Digitalmars-d-learn
mailing list