Hello! In the study of sets, the question arose : How to combine two not many of this type(the left side)?

How to cross the right part I know :

But at the expense of the left in difficulties. Tried to do by analogy, but there it was :

This code snippet does not work properly.

Therefore, I ask Your help.

How to cross the right part I know :

```
set<int> inter_no_AB;
set_intersection(begin(universum_diff_A), end(universum_diff_A),
begin(universum_diff_B), end(universum_diff_B),
inserter(inter_no_AB, begin(inter_no_AB)));</int>
```

But at the expense of the left in difficulties. Tried to do by analogy, but there it was :

```
set<int> diff_union;
set_union(begin(universum_diff_A), end(universum_diff_A),
begin(universum_diff_B), end(universum_diff_B),
inserter(diff_union, begin(diff_union)));</int>
```

This code snippet does not work properly.

Therefore, I ask Your help.

asked July 4th 19 at 23:05

1 answer

answered on July 4th 19 at 23:07

If the original set given, something like this:

```
set<int> A_union_B;
set<int> diff_union;
set_union(begin(A), end(A),
begin(B) end(B),
inserter(A_union_B, begin(A_union_B)));
set_difference(begin(universum), end(universum),
begin(A_union_B), end(A_union_B),
inserter(diff_union, begin(diff_union)));</int></int>
```

Find more questions by tags C++ProgrammingProgramming languages