More helpful error message

release/4.3a0
Richard Roberts 2012-03-04 17:25:10 +00:00
parent 5bb1564a74
commit 275c0ff4d3
1 changed files with 3 additions and 3 deletions

View File

@ -45,12 +45,12 @@ namespace gtsam {
void Factor<KEY>::assertInvariants() const { void Factor<KEY>::assertInvariants() const {
#ifndef NDEBUG #ifndef NDEBUG
// Check that keys are all unique // Check that keys are all unique
std::multiset < KeyType > nonunique(keys_.begin(), keys_.end()); std::multiset<KeyType> nonunique(keys_.begin(), keys_.end());
std::set < KeyType > unique(keys_.begin(), keys_.end()); std::set<KeyType> unique(keys_.begin(), keys_.end());
bool correct = (nonunique.size() == unique.size()) bool correct = (nonunique.size() == unique.size())
&& std::equal(nonunique.begin(), nonunique.end(), unique.begin()); && std::equal(nonunique.begin(), nonunique.end(), unique.begin());
if (!correct) throw std::logic_error( if (!correct) throw std::logic_error(
"Factor::assertInvariants: detected inconsistency"); "Factor::assertInvariants: Factor contains duplicate keys");
#endif #endif
} }