[ create a new paste ] login | about

Link: http://codepad.org/NW9ZXEIc    [ raw code | fork ]

sehe - C++, pasted on Apr 6:
#include <vector>
#include <algorithm>
#include <set>

typedef std::vector<int> Vec;

template <typename T> struct Contained
{
	const std::set<T> _set;
	template <typename It> Contained(const It& begin, const It& end) : _set(begin, end) {}
	bool operator()(const T& i) const 
	{ 
		return _set.end() != _set.find(i);
	}
};

int main()
{
	Vec vecA;
	Vec vecB;

	std::remove_copy_if(vecB.begin(), vecB.end(), back_inserter(vecA), Contained<int>(vecA.begin(), vecA.end()));
}


Output:
No errors or program output.


Create a new paste based on this one


Comments: