DEFECT_OLD_STL_COUNT
Systems: all
Compilers: GNU C++ 2.7, SGI MipsPro 7.1nx, RogueWave C++ Stdlib
The means by which the STL algorithms count() and count_if() returns their result has changed during the C++ standardization effort. These methods now return their result as the return value. All traditional STL implementations have count() returning its result via a reference argument and ecalred with a void return value.
// Simplified standard C++ signature for count(), count_if()
difference_type count( InputIterator first, InputIterator last, const TYPE& value) ;
difference_type count_if(InputIterator first, InputIterator last, Predicate pred) ;
// Simplified traditional C++ signature for count(), count_if()
void count( InputIterator first, InputIterator last, const TYPE& value, Size& result) ;
void count_if(InputIterator first, InputIterator last, Predicate pred, Size& result) ;
// Count number of iters from iter_first to iter_last for which *iter == goal_value
#if defined(DEFECT_OLD_STL_COUNT)
count(iter_first, iter_last, goal_value, result) ;
#else // Standard C++
result = count(iter_first, iter_last, goal_value) ;
#endif