More helpful error message
parent
5bb1564a74
commit
275c0ff4d3
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue