In C++, I'm looking to implement an operator for selecting items in a list (of type B) based upon B being contained entirely within A.
In the book "the logical design of digital computers" by Montgomery Phister jr (published 1958), p54, it says:
F11 = A + ~B has two interesting and useful associations, neither of them having much to do with computer design. The first is the logical notation of implication... The second is notation of inclusion... This may be expressed by a familiar looking relation, B < A; or by the statement "B is included in A"; or by the boolean equation F11= A + ~B = 1.
My initial implementation was in C. Callbacks were given to the list to use for such operations. An example being a list of ints, and a struct containting two ints, min and max, for selection purposes.
There, selection would be based upon B >= A->min && B <= A->max.
Using C++ and templates, how would you approach this after having implemented a generic list in C using void pointers and callbacks?
Is using < as an over-ridden operator for such purposes... <ugh> evil? </ugh>
(or by using a class B for the selection criteria, implementing the comparison by overloading > ?)
edit: my implementation of the nodes for the list contains a member for flagging item selection or not.
with regards to sets, and uniqueness, the data in the list will likely contain a member specifying position along a time line, given that is one of the main selection criteria, using the term set might be misleading as there is no guaranteed uniqueness regarding position along the time line - that is events can occur simultaneously.