I come from a fairly functional programming background, and I'm not used to C ++ (efficient) data structures. I need a data structure that stores several elements, as shown in a struct element . In the collection, the field identifier must be unique.
I want to make a very quick comparison, for example, in set theory, for example, when comparing the sets {x1,x2,x3} and {x4,x5} . I want to define a set of intersections {x5} (or {x2} that are equal in this case) and sets from other sets, for example, {x1,x2,x3} \ {x5} = {x1,x3} .
Is there ... a "set-theoretic" data structure out there in the C ++ universe?
struct element { int id; float value; }; struct element x1 = {1, 1.0}; struct element x2 = {2, 2.0}; struct element x3 = {3, 3.0}; struct element x4 = {3, 3.1}; struct element x5 = {2, 2.0};
source share