Hi D

I'm working on a bit of code that handles selecting one *.front from multiple range-ish objects. It's a select-or-drop algorithm for a data streaming service, the details aren't important.

The algorithm takes a range of something I'll call "PriorityRange" objects. PriorityRange objects are like input ranges, but have a few extra members. The set is:

  .empty     :  Returns bool
  .front     :  Returns something non-void
  .popFront():  Return void

  .priority  :  Returns something comparable via "<" to other
                .priority values for all input PriortyRanges

  .min       :  Returns something comparable to .max below
                via "<" for all input PriorityRanges

  .max       :  Returns something comparable to .min above
                via "<" for all input PriorityRanges

I noticed the isInputRange(R) enum from std/range/primitives.d and am wondering how to setup a similar check, call it "isPriorityRange(PR)".

My problem is that I don't know how to specify that properties must be comparable via "<". I took a look at the Traits module, but there are more things that are comparable then Arithmetic or Floating point types. Also, since the compiler will catch objects that don't have these properties, maybe an enum check is not worth implementing.

Thanks very much for any advice you might have,
Cheers

Reply via email to