]> git.donarmstrong.com Git - lilypond.git/commitdiff
Use iterator for STL std::map element access.
authorPatrick McCarty <pnorcks@gmail.com>
Sun, 28 Mar 2010 22:55:51 +0000 (15:55 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Tue, 30 Mar 2010 21:37:35 +0000 (14:37 -0700)
The at() function for std::map was added for libstdc++ release 4.1, and
it is not part of the official STL.

Also some developers are still using libstdc++ 4.0, so using at() will
not compile.

Instead, use an iterator for std::map element access, which is the
standard (albeit annoying) practice.

lily/open-type-font.cc

index de3228dbf460a66ae9cbe9ae8ba81dd86f1ea0bb..741f9741faefeeaa45ff2b590f6db73d01900cc6 100644 (file)
@@ -241,7 +241,16 @@ Open_type_font::name_to_index (string nm) const
 size_t
 Open_type_font::index_to_charcode (size_t i) const
 {
-  return index_to_charcode_map_.at (i);
+  map<FT_UInt, FT_ULong>::const_iterator iter;
+  iter = index_to_charcode_map_.find (i);
+
+  if (iter != index_to_charcode_map_.end ())
+    return (size_t) iter->second;
+  else
+    {
+      programming_error (_ ("Invalid index for character"));
+      return 0;
+    }
 }
 
 size_t