From 37af90a50e93ac7f5fb50cac08326781ded6da14 Mon Sep 17 00:00:00 2001 From: Takashi Tamura Date: Sun, 29 Jan 2017 11:11:55 +0900 Subject: [PATCH] use equal_range instead of upper_bound. unordered containers do not have the upper_bound method. --- Lib/ruby/std_multimap.i | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Lib/ruby/std_multimap.i b/Lib/ruby/std_multimap.i index 3e06ee12c..762a87653 100644 --- a/Lib/ruby/std_multimap.i +++ b/Lib/ruby/std_multimap.i @@ -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 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( i->second ) ); }