Hello, I want to suggest to add function array_fast_compare which will be to compare two array with instantaneous speed (50ms, 2 two arrays with 20000 elements) to find difference or union.
Which functions in C++ Builder:
PHP Code:
#include <set>
#include <algorithm>
#include <iterator>
#include <system.hpp>
int array_string_compare(String sArray1[], int iArrCount1, String sArray2[], int iArrCount2, String sArray3[], int iTypeCompare)
{
std::set<String> trie1(sArray1, sArray1+iArrCount1), trie2(sArray2, sArray2+iArrCount2), trie3;
std::set<String>::const_iterator itr, end_itr1, end_itr2;
std::insert_iterator<std::set<String> > trie3_ins(trie3, trie3.begin());
switch (iTypeCompare)
{
case 0:
set_difference(trie1.begin(), trie1.end(), trie2.begin(), trie2.end(), trie3_ins);
break;
case 1:
set_symmetric_difference(trie1.begin(), trie1.end(), trie2.begin(), trie2.end(), trie3_ins);
break;
case 2:
set_union(trie1.begin(), trie1.end(), trie2.begin(), trie2.end(), trie3_ins);
break;
case 3:
set_intersection(trie1.begin(), trie1.end(), trie2.begin(), trie2.end(), trie3_ins);
break;
}
int iCount = 0;
for ( itr = trie3.begin(); itr != trie3.end(); itr++)
{
sArray3[iCount++] = *itr;
}
return iCount;
}
int array_int_compare(int sArray1[], int iArrCount1, int sArray2[], int iArrCount2, int sArray3[], int iTypeCompare)
{
std::set<int> trie1(sArray1, sArray1+iArrCount1), trie2(sArray2, sArray2+iArrCount2), trie3;
std::set<int>::const_iterator itr, end_itr1, end_itr2;
std::insert_iterator<std::set<int> > trie3_ins(trie3, trie3.begin());
switch (iTypeCompare)
{
case 0:
set_difference(trie1.begin(), trie1.end(), trie2.begin(), trie2.end(), trie3_ins);
break;
case 1:
set_symmetric_difference(trie1.begin(), trie1.end(), trie2.begin(), trie2.end(), trie3_ins);
break;
case 2:
set_union(trie1.begin(), trie1.end(), trie2.begin(), trie2.end(), trie3_ins);
break;
case 3:
set_intersection(trie1.begin(), trie1.end(), trie2.begin(), trie2.end(), trie3_ins);
break;
}
int iCount = 0;
for ( itr = trie3.begin(); itr != trie3.end(); itr++)
{
sArray3[iCount++] = *itr;
}
return iCount;
}
Please tell me what programs do I need to compile the module from source? I want to try to do something with module.