void ExtremalQuery3BSP<Real>::CreateBSPTree ( std::multiset<SphericalArc>& arcs, std::vector<SphericalArc>& nodes) { // The tree has at least a root. mTreeDepth = 1; typename std::multiset<SphericalArc>::reverse_iterator iter; for (iter = arcs.rbegin(); iter != arcs.rend(); ++iter) { InsertArc(*iter, nodes); } // The leaf nodes are not counted in the traversal of InsertArc. The // depth must be incremented to account for leaves. ++mTreeDepth; }
void f_multiset() { std::multiset<int> C; std::multiset<int>::iterator MSetI1 = C.begin(); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when declaring iterators // CHECK-FIXES: auto MSetI1 = C.begin(); std::multiset<int>::reverse_iterator MSetI2 = C.rbegin(); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when declaring iterators // CHECK-FIXES: auto MSetI2 = C.rbegin(); const std::multiset<int> D; std::multiset<int>::const_iterator MSetI3 = D.begin(); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when declaring iterators // CHECK-FIXES: auto MSetI3 = D.begin(); std::multiset<int>::const_reverse_iterator MSetI4 = D.rbegin(); // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when declaring iterators // CHECK-FIXES: auto MSetI4 = D.rbegin(); }
int main() { { typedef int V; V ar[] = { 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8 }; std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0])); assert(std::distance(m.begin(), m.end()) == m.size()); assert(std::distance(m.rbegin(), m.rend()) == m.size()); std::multiset<int>::iterator i; i = m.begin(); std::multiset<int>::const_iterator k = i; assert(i == k); for (int j = 1; j <= 8; ++j) for (int k = 0; k < 3; ++k, ++i) assert(*i == j); } { typedef int V; V ar[] = { 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8 }; const std::multiset<int> m(ar, ar+sizeof(ar)/sizeof(ar[0])); assert(std::distance(m.begin(), m.end()) == m.size()); assert(std::distance(m.cbegin(), m.cend()) == m.size()); assert(std::distance(m.rbegin(), m.rend()) == m.size()); assert(std::distance(m.crbegin(), m.crend()) == m.size()); std::multiset<int, double>::const_iterator i; i = m.begin(); for (int j = 1; j <= 8; ++j) for (int k = 0; k < 3; ++k, ++i) assert(*i == j); } }