本文整理汇总了C++中KeySet::crbegin方法的典型用法代码示例。如果您正苦于以下问题:C++ KeySet::crbegin方法的具体用法?C++ KeySet::crbegin怎么用?C++ KeySet::crbegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeySet
的用法示例。
在下文中一共展示了KeySet::crbegin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(test_iter, const_iterate)
{
std::cout << "testing const iterate" << std::endl;
const KeySet ks2 (5,
*Key ("user/key2/1", KEY_END),
*Key ("user/key2/2", KEY_END),
*Key ("user/key2/3", KEY_VALUE, "value", KEY_END),
KS_END);
ASSERT_EQ((*ks2.begin()).getName() , "user/key2/1" ) << "name wrong";
ASSERT_EQ(ks2.begin()->getName() , "user/key2/1" ) << "name wrong";
ASSERT_EQ((ks2.begin()[0])->getName() , "user/key2/1" ) << "name wrong";
ASSERT_EQ((*(++ks2.begin())).getName() , "user/key2/2") << "name wrong";
ASSERT_EQ((++ks2.begin())->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((*(ks2.begin()+1)).getName() , "user/key2/2") << "name wrong";
ASSERT_EQ((ks2.begin()+1)->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((ks2.begin()[1])->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((*(ks2.begin()+2)).getName() , "user/key2/3") << "name wrong";
ASSERT_EQ((ks2.begin()+2)->getName() , "user/key2/3" ) << "name wrong";
ASSERT_EQ((ks2.begin()[2])->getName() , "user/key2/3" ) << "name wrong";
ASSERT_EQ((ks2.begin()+3) , ks2.end() ) << "end iterator broken";
ASSERT_EQ((*ks2.rbegin()).getName() , "user/key2/3" ) << "name wrong";
ASSERT_EQ(ks2.rbegin()->getName() , "user/key2/3" ) << "name wrong";
ASSERT_EQ((ks2.rbegin()[0])->getName() , "user/key2/3" ) << "name wrong";
ASSERT_EQ((*(++ks2.rbegin())).getName() , "user/key2/2") << "name wrong";
ASSERT_EQ((++ks2.rbegin())->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((*(ks2.rbegin()+1)).getName() , "user/key2/2") << "name wrong";
ASSERT_EQ((ks2.rbegin()+1)->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((ks2.rbegin()[1])->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((*(ks2.rbegin()+2)).getName() , "user/key2/1") << "name wrong";
ASSERT_EQ((ks2.rbegin()+2)->getName() , "user/key2/1" ) << "name wrong";
ASSERT_EQ((ks2.rbegin()[2])->getName() , "user/key2/1" ) << "name wrong";
ASSERT_EQ((ks2.rbegin()+3) , ks2.rend() ) << "end iterator broken";
ASSERT_EQ((*ks2.cbegin()).getName() , "user/key2/1" ) << "name wrong";
ASSERT_EQ(ks2.cbegin()->getName() , "user/key2/1" ) << "name wrong";
ASSERT_EQ((ks2.cbegin()[0])->getName() , "user/key2/1" ) << "name wrong";
ASSERT_EQ((*(++ks2.cbegin())).getName() , "user/key2/2") << "name wrong";
ASSERT_EQ((++ks2.cbegin())->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((*(ks2.cbegin()+1)).getName() , "user/key2/2") << "name wrong";
ASSERT_EQ((ks2.cbegin()+1)->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((ks2.cbegin()[1])->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((*(ks2.cbegin()+2)).getName() , "user/key2/3") << "name wrong";
ASSERT_EQ((ks2.cbegin()+2)->getName() , "user/key2/3" ) << "name wrong";
ASSERT_EQ((ks2.cbegin()[2])->getName() , "user/key2/3" ) << "name wrong";
ASSERT_EQ((ks2.cbegin()+3) , ks2.cend() ) << "end iterator broken";
ASSERT_EQ((*ks2.crbegin()).getName() , "user/key2/3" ) << "name wrong";
ASSERT_EQ(ks2.crbegin()->getName() , "user/key2/3" ) << "name wrong";
ASSERT_EQ((ks2.crbegin()[0])->getName() , "user/key2/3" ) << "name wrong";
ASSERT_EQ((*(++ks2.crbegin())).getName() , "user/key2/2") << "name wrong";
ASSERT_EQ((++ks2.crbegin())->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((*(ks2.crbegin()+1)).getName() , "user/key2/2") << "name wrong";
ASSERT_EQ((ks2.crbegin()+1)->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((ks2.crbegin()[1])->getName() , "user/key2/2" ) << "name wrong";
ASSERT_EQ((*(ks2.crbegin()+2)).getName() , "user/key2/1") << "name wrong";
ASSERT_EQ((ks2.crbegin()+2)->getName() , "user/key2/1" ) << "name wrong";
ASSERT_EQ((ks2.crbegin()[2])->getName() , "user/key2/1" ) << "name wrong";
ASSERT_EQ((ks2.crbegin()+3) , ks2.crend() ) << "end iterator broken";
}