bugfix correct asserts for nth element stat
This commit is contained in:
parent
2b80b91d28
commit
6f4ecc603b
1 changed files with 2 additions and 1 deletions
|
|
@ -502,12 +502,13 @@ public:
|
||||||
{
|
{
|
||||||
unsigned int nth;
|
unsigned int nth;
|
||||||
if( _nth == -1 ) { // asked for a ratio
|
if( _nth == -1 ) { // asked for a ratio
|
||||||
|
assert( _ratio >= 0 && _ratio <= 1 );
|
||||||
nth = static_cast<unsigned int>( std::floor(_pop.size() * _ratio) );
|
nth = static_cast<unsigned int>( std::floor(_pop.size() * _ratio) );
|
||||||
} else {
|
} else {
|
||||||
assert( _ratio == -1 ); // asked for a position
|
assert( _ratio == -1 ); // asked for a position
|
||||||
|
assert( _nth >= 0 );
|
||||||
nth = static_cast<unsigned int>(_nth);
|
nth = static_cast<unsigned int>(_nth);
|
||||||
}
|
}
|
||||||
assert( nth >= 0 );
|
|
||||||
assert( nth < _pop.size() );
|
assert( nth < _pop.size() );
|
||||||
|
|
||||||
if( _pop.size() == 0 ) {
|
if( _pop.size() == 0 ) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue