From 5f0cb9f36b091f206d0903a8ab840b429c37515c Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Sun, 28 Mar 2010 15:55:51 -0700 Subject: [PATCH] Use iterator for STL std::map element access. 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 | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/lily/open-type-font.cc b/lily/open-type-font.cc index de3228d..741f974 100644 --- a/lily/open-type-font.cc +++ b/lily/open-type-font.cc @@ -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::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 -- 1.7.0.3