00001 //---------------------------------------------------------------------------- 00002 /** @file SgVectorUtil.cpp 00003 See SgVectorUtil.h */ 00004 //---------------------------------------------------------------------------- 00005 00006 #include "SgSystem.h" 00007 #include "SgVectorUtil.h" 00008 00009 #include <algorithm> 00010 00011 //---------------------------------------------------------------------------- 00012 00013 void SgVectorUtil::Difference(SgVector<int>* vector, 00014 const SgVector<int>& vector2) 00015 { 00016 // @todo speed up by using tags, if used in time-critical code. 00017 for (SgVectorIterator<int> it(vector2); it; ++it) 00018 vector->Exclude(*it); 00019 } 00020 00021 void SgVectorUtil::Intersection(SgVector<int>* vector, 00022 const SgVector<int>& vector2) 00023 { 00024 SgVector<int> newVector; 00025 for (SgVectorIterator<int> it(*vector); it; ++it) 00026 { 00027 // @todo speed up by hash tags, if used in time-critical code 00028 if (vector2.Contains(*it)) 00029 newVector.PushBack(*it); 00030 } 00031 newVector.SwapWith(vector); 00032 }