std::vector<int> findSame(const std::vector<int> &nLeft,const std::vector<int> &nRight)
{
std::vector<int> nResult;
for (std::vector<int>::const_iterator nIterator = nLeft.begin(); nIterator != nLeft.end(); nIterator++)
{
if(std::find(nRight.begin(),nRight.end(),*nIterator) != nRight.end())
nResult.push_back(*nIterator);
}
return nResult;
}原文:http://wwhx27.blog.51cto.com/6807550/1631096