Answer the question
In order to leave comments, you need to log in
Can't find multiset intersections, what's the problem?
I need to find the intersections of two multisets, each of which is inside a vector.
Here is the part of the code where I did it:
unordered_multiset <char> intersect; //множество для результата пересечения
unordered_multiset <char> first;
unordered_multiset <char> second;
for (int i = 0; i < Sentence.size(); i++) { //Sentence - это vector <unordered_multiset<char>>
for (int j = 0; j < Dictionary.size(); j++) { //Dictionary - это тоже vector <unordered_multiset<char>>
first = Sentence[i];
second = Dictionary[j];
set_intersection(first.begin(), first.end(), second.begin(), second.end(), intersect.begin());
set_intersection(first.begin(), first.end(), second.begin(), second.end(), intersect.begin());
intersect.begin()
The program compiles, but stops at inserter(intersect, intersect.begin())
Answer the question
In order to leave comments, you need to log in
The problem is that unordered_set iterators are of type ForwardIterator. The set_intersection options that expect an iterator like this for the result also want an ExecutionPolicy.
But even if you change the type of the intersect so that the answer can be inserted there, your code will not work, because set_intersection waits for ordered intervals. Does unordered
the name of the containers bother you?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question