-
Notifications
You must be signed in to change notification settings - Fork 4
/
fix_fs_iter.patch
36 lines (31 loc) · 1.39 KB
/
fix_fs_iter.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
diff --git a/include/DBoW2/TemplatedVocabulary.h b/include/DBoW2/TemplatedVocabulary.h
index 6d8d621..c95e72e 100644
--- a/include/DBoW2/TemplatedVocabulary.h
+++ b/include/DBoW2/TemplatedVocabulary.h
@@ -1473,12 +1473,12 @@ void TemplatedVocabulary<TDescriptor,F>::load(const cv::FileStorage &fs,
m_nodes.resize(fn.size() + 1); // +1 to include root
m_nodes[0].id = 0;
- for(unsigned int i = 0; i < fn.size(); ++i)
+ for(auto iter = fn.begin(); iter != fn.end(); ++iter)
{
- NodeId nid = (int)fn[i]["nodeId"];
- NodeId pid = (int)fn[i]["parentId"];
- WordValue weight = (WordValue)fn[i]["weight"];
- std::string d = (std::string)fn[i]["descriptor"];
+ NodeId nid = (int)(*iter)["nodeId"];
+ NodeId pid = (int)(*iter)["parentId"];
+ WordValue weight = (WordValue)(*iter)["weight"];
+ std::string d = (std::string)(*iter)["descriptor"];
m_nodes[nid].id = nid;
m_nodes[nid].parent = pid;
@@ -1493,10 +1493,10 @@ void TemplatedVocabulary<TDescriptor,F>::load(const cv::FileStorage &fs,
m_words.resize(fn.size());
- for(unsigned int i = 0; i < fn.size(); ++i)
+ for(auto iter = fn.begin(); iter != fn.end(); ++iter)
{
- NodeId wid = (int)fn[i]["wordId"];
- NodeId nid = (int)fn[i]["nodeId"];
+ NodeId wid = (int)(*iter)["wordId"];
+ NodeId nid = (int)(*iter)["nodeId"];
m_nodes[nid].word_id = wid;
m_words[wid] = &m_nodes[nid];