mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
More C++11ification.
1. Replace HashMap and HashSet with std::unordered_map and std::unordered_set respectively. 2. Extract the pair hasher into a struct pair_hash. 3. Delete collections_port.h 4. Convert explicit iterator based loops to auto based loops where sensible. Change-Id: Ib88bcd13a7463d18435639d3b771abaa52080efb
This commit is contained in:
@@ -234,23 +234,18 @@ bool ApplyOrdering(const ProblemImpl::ParameterMap& parameter_map,
|
||||
parameter_blocks->clear();
|
||||
|
||||
const map<int, set<double*> >& groups = ordering.group_to_elements();
|
||||
for (map<int, set<double*> >::const_iterator group_it = groups.begin();
|
||||
group_it != groups.end();
|
||||
++group_it) {
|
||||
const set<double*>& group = group_it->second;
|
||||
for (set<double*>::const_iterator parameter_block_ptr_it = group.begin();
|
||||
parameter_block_ptr_it != group.end();
|
||||
++parameter_block_ptr_it) {
|
||||
ProblemImpl::ParameterMap::const_iterator parameter_block_it =
|
||||
parameter_map.find(*parameter_block_ptr_it);
|
||||
if (parameter_block_it == parameter_map.end()) {
|
||||
for (const auto& p : groups) {
|
||||
const set<double*>& group = p.second;
|
||||
for (double* parameter_block_ptr : group) {
|
||||
auto it = parameter_map.find(parameter_block_ptr);
|
||||
if (it == parameter_map.end()) {
|
||||
*error = StringPrintf("User specified ordering contains a pointer "
|
||||
"to a double that is not a parameter block in "
|
||||
"the problem. The invalid double is in group: %d",
|
||||
group_it->first);
|
||||
p.first);
|
||||
return false;
|
||||
}
|
||||
parameter_blocks->push_back(parameter_block_it->second);
|
||||
parameter_blocks->push_back(it->second);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user