about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-27 10:50:33 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-27 10:50:33 -0700
commitab2ee1d4afe9cf595fd64ba306c43c3aa4ceb8ce (patch)
treee43cd8fd236da79252292bbe21a250b6e7cec67d /subx
parent29426e5d765f10e10aeb3d5380a3fa91bd2bfed9 (diff)
downloadmu-ab2ee1d4afe9cf595fd64ba306c43c3aa4ceb8ce.tar.gz
4436
Diffstat (limited to 'subx')
-rw-r--r--subx/001help.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/subx/001help.cc b/subx/001help.cc
index 65e291c5..efb3ac46 100644
--- a/subx/001help.cc
+++ b/subx/001help.cc
@@ -226,12 +226,18 @@ int feenableexcept(unsigned int excepts) {
 // from http://stackoverflow.com/questions/152643/idiomatic-c-for-reading-from-a-const-map
 template<typename T> typename T::mapped_type& get(T& map, typename T::key_type const& key) {
   typename T::iterator iter(map.find(key));
-  assert(iter != map.end());
+  if (iter == map.end()) {
+    cerr << "get couldn't find key '" << key << "'\n";
+    assert(iter != map.end());
+  }
   return iter->second;
 }
 template<typename T> typename T::mapped_type const& get(const T& map, typename T::key_type const& key) {
   typename T::const_iterator iter(map.find(key));
-  assert(iter != map.end());
+  if (iter == map.end()) {
+    cerr << "get couldn't find key '" << key << "'\n";
+    assert(iter != map.end());
+  }
   return iter->second;
 }
 template<typename T> typename T::mapped_type const& put(T& map, typename T::key_type const& key, typename T::mapped_type const& value) {
href='#n163'>163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260