By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,112 Members | 1,642 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,112 IT Pros & Developers. It's quick & easy.

STL set intersection question

P: n/a
Hello,

I'm trying to get the result of a set intersection and I'm sure that I've
made a very basic error.

A Google search has helped but I'm still not quite there. Can someone show
me the error?

set<intfirstSet;

secondSet.insert(1);
secondSet.insert(2);

set<intsecondSet;

secondSet.insert(2);

set<intresultSet;

resultSet = set_intersection(firstSet.begin(), firstSet.end(),
secondSet.begin(), secondSet.end(), resultSet.begin());

--
Regards,
Phil.

Jul 15 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Phil wrote:
Hello,

I'm trying to get the result of a set intersection and I'm sure that I've
made a very basic error.

A Google search has helped but I'm still not quite there. Can someone show
me the error?

set<intfirstSet;

secondSet.insert(1);
secondSet.insert(2);

set<intsecondSet;

secondSet.insert(2);

set<intresultSet;

resultSet = set_intersection(firstSet.begin(), firstSet.end(),
secondSet.begin(), secondSet.end(), resultSet.begin());
This does seem to compile:
vector<intvi;
set_intersection(firstSet.begin(), firstSet.end(),
secondSet.begin(), secondSet.end(),
vi.begin());

Jul 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.