How to find the intersection of two STL sets?

You haven’t provided an output iterator for set_intersection template <class InputIterator1, class InputIterator2, class OutputIterator> OutputIterator set_intersection ( InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result ); Fix this by doing something like …; set<int> intersect; set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), std::inserter(intersect, intersect.begin())); You need a std::insert iterator since the set is as of … Read more

C++, copy set to vector

You need to use a back_inserter: std::copy(input.begin(), input.end(), std::back_inserter(output)); std::copy doesn’t add elements to the container into which you are inserting: it can’t; it only has an iterator into the container. Because of this, if you pass an output iterator directly to std::copy, you must make sure it points to a range that is at … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)