set intersection - Trouble with set_union and set_intersection - C++ -
I am currently working on a project related to set calculations. I am using the function set_inien and set_insecure to calculate the union and intersection of sets. My variables are:
int AunionB [8]; Int Annian Sea [7]; // defined AunionC en BunionD [9]; // Define BunionD int AintersectB [4]; // Define intercact with antentec [3]; // Define Antareskect Set & lt; Int & gt; FinalUnion; // The final team of A, B, C, D set & lt; Int & gt; FinalIntersection; The last interval of A, B, C, D // These sequences of these four sets are respectively union and intersection: set A, set B, set C, and seti my set_union function are as follows: Set_union (AunionC, AunionC + 7, BunionD, BunionD + 9, finalUnion.begin ());
And my set_intersction function is as follows:
set_intersection (entersexteb, entersect b +4, antterspectac, extractor + 3, final intrusion. ));
When I compile, I get the "Required from here" error, which means I'm not sure. Can someone please help me with this? I believe this is something with set_union and set_interscture functions and their parameters, but I'm not sure.
use instead
#include & lt; Iterator & gt; // ... set_enian (AunionC, AunionC + 7, BunionD, BunionD + 9, std :: inserter (final Yuanian, finalUnion.begin ()));
and
set_intersection (entersexteb, entersch b + 4, anttersx, antercacteq + 3, std :: inseter (final interval, last interaction. )));
A perfect example
#include & lt; Iostream & gt; # Include & lt; Algorithm & gt; #include & lt; Iterator & gt; # Include & lt; Set & gt; Int main () {int a [] = {1, 3, 5}; Int b [] = {0, 2, 4, 6}; Std :: set & lt; Integer & gt; S; Std :: set_union (std :: start (a), std :: end (a), std :: begin (b), std :: end (b), std :: inserter (s, s.begin ()) ); (Int x: s) for std :: cout & lt; & Lt; X & LT; & Lt; ''; Std :: cout & lt; & Lt; Std :: endl; Return 0; }
is output
0 1 2 3 4 5 6
Comments
Post a Comment