Obtain predicate from SortedRange

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 9 02:02:35 PST 2016


On Wednesday, November 09, 2016 09:37:18 RazvanN via Digitalmars-d-learn 
wrote:
> Given a SortedRange object, is there a way to obtain the
> predicate which was used for it to be sorted?

No. It only exists as a template argument to SortedRange and an alias within
it, not as something that's actually part of the range object, and that
alias is private. If you want access to the predicate, then you're going to
have to pass something to sort or SortedRange which you can access
separately from the SortedRange (e.g. an actual function rather than a
lambda).

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list