summaryrefslogtreecommitdiff
path: root/utils/sparse_vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/sparse_vector.h')
-rw-r--r--utils/sparse_vector.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/utils/sparse_vector.h b/utils/sparse_vector.h
index 7ac85d1d..e3904403 100644
--- a/utils/sparse_vector.h
+++ b/utils/sparse_vector.h
@@ -145,7 +145,7 @@ public:
if (!(s>>v)) error("reading value failed");
}
std::pair<iterator,bool> vi=values_.insert(value_type(k,v));
- if (vi.second) {
+ if (!vi.second) {
T &oldv=vi.first->second;
switch(dp) {
case NO_DUPS: error("read duplicate key with NO_DUPS. key="
@@ -157,9 +157,11 @@ public:
}
}
}
- return;
+ goto good;
eof:
if (!s.eof()) error("reading key failed (before EOF)");
+ good:
+ s.clear(); // we may have reached eof, but that's no error.
}
friend inline std::ostream & operator<<(std::ostream &o,Self const& s) {