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