本文整理汇总了C++中std::multiset::rbegin方法的典型用法代码示例。如果您正苦于以下问题:C++ multiset::rbegin方法的具体用法?C++ multiset::rbegin怎么用?C++ multiset::rbegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::multiset
的用法示例。
在下文中一共展示了multiset::rbegin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InsertArc
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;
}
示例2: f_multiset
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();
}
示例3: main
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);
}
}