use equal_range instead of upper_bound.
unordered containers do not have the upper_bound method.
This commit is contained in:
parent
b8cf6412e8
commit
37af90a50e
1 changed files with 3 additions and 4 deletions
|
|
@ -90,12 +90,11 @@
|
|||
|
||||
%extend {
|
||||
VALUE __getitem__(const key_type& key) const {
|
||||
MultiMap::const_iterator i = self->find(key);
|
||||
if ( i != self->end() )
|
||||
std::pair<MultiMap::const_iterator, MultiMap::const_iterator > r = $self->equal_range(key);
|
||||
if ( r.first != r.second )
|
||||
{
|
||||
MultiMap::const_iterator e = $self->upper_bound(key);
|
||||
VALUE ary = rb_ary_new();
|
||||
for ( ; i != e; ++i )
|
||||
for (MultiMap::const_iterator i = r.first ; i != r.second; ++i )
|
||||
{
|
||||
rb_ary_push( ary, swig::from<MultiMap::mapped_type>( i->second ) );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue