----------- sample code ------>
const unsigned numSet1= 5;
const unsigned numSet2= 5;
int set1[numSet1] = { 1,2,3,4,5 };
int set2[numSet2] = { 2,3,3,4,5 };
if (std::includes(set1, set1 + numSet1, set2, set2 + numSet2))
std::cout << "set2 is a subset of set1" << std::endl;
else
std::cout << "set2 is not subset of set1" << std::endl;
<----------- sample code ------
Comparing the VC implementation with the STLPort shows an
important difference:
template<class _II1, class _II2> inline
bool includes(_II1 _F1, _II1 _L1, _II2 _F2, _II2 _L2)
{for (; _F1 != _L1 && _F2 != _L2; )
if (*_F2 < *_F1)
return (false);
else if (*_F1 < *_F2)
++_F1;
else
++_F2; // STLport has here: ++_F1,++_F2
return (_F2 == _L2); }
I have corrected the VC <algorithm> file and it is o.k. now.
Anyway it would be very interesting to know Microsofts opinion in
the area of STL problems with VC. Do they fix the STL bugs in VC
or is it better for the developer switching to an external
implementation like STLport?
--
Hans
mailto:hans.e...@t-online.de