On Thu, Mar 3, 2016 at 2:06 PM, Joaquin M LópezMuñoz <joaquin@tid.es> wrote:
Dominique Devienne <ddevienne <at> gmail.com> writes:
> On Thu, Mar 3, 2016 at 10:21 AM, Joaquin M LópezMuñoz <joaquin <at>
> But can we do better? If like in any initial email, you take into account
> that the to-be-indexed int is part of a larger struct with other fields,
> which can be used to "break ties" between elements who's index
> match the "puncture"?
>
> [...]
>
> struct entry {
>   int uid; // real uuid in reality, but enough for our needs here
>   int occurence; // the field to be indexed, uniquely "except for -1"
> };

OK, yes, we can do something with that. What you want is unique sorting
by occurrence, except when occurrence==-1 in which case you want to
(uniquely) sort lexicographically on uid. This *is* indeed a SWO, [...]

Thank you for confirming what I suspected.

[...] Thanks to the overloads of entry_occurrence_less::operator()
we can lookup by occurrence as if we were using
member<entry,int,&entry::occurence>:

This is the part I was missing, and struggling with.
Seems simple, in hindsight :)
 
I think this suits exactly your needs, please report back otherwise.

Thank you so much for your help Joaquin. (and for BMI of course! My favorite container!!!)

This is exactly what I was looking for. Encore merci, --DD