Author: sebor
Date: Wed Jan 25 18:52:09 2006
New Revision: 372411
URL: http://svn.apache.org/viewcvs?rev=372411&view=rev
Log:
2006-01-25 Martin Sebor <[EMAIL PROTECTED]>
* algorithm.cc (random_shuffle): Asserted a precondition.
Modified:
incubator/stdcxx/trunk/include/algorithm.cc
Modified: incubator/stdcxx/trunk/include/algorithm.cc
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/include/algorithm.cc?rev=372411&r1=372410&r2=372411&view=diff
==============================================================================
--- incubator/stdcxx/trunk/include/algorithm.cc (original)
+++ incubator/stdcxx/trunk/include/algorithm.cc Wed Jan 25 18:52:09 2006
@@ -604,6 +604,9 @@
// and to the iterator's difference_type but nothing else
const _DiffT __rndoff (__rand (__limit));
+ // returned value must be non-negative and less than the limit
+ _RWSTD_ASSERT (0 <= __rndoff && __rndoff < __limit);
+
_STD::iter_swap (__i, __first + __rndoff);
}
}