本文整理汇总了C++中ptree::merkle方法的典型用法代码示例。如果您正苦于以下问题:C++ ptree::merkle方法的具体用法?C++ ptree::merkle怎么用?C++ ptree::merkle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ptree
的用法示例。
在下文中一共展示了ptree::merkle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: REQUIRE
ptree c;
// Verify basic get woks
a.set("Hello", "World");
a.set("foo", "bar");
a.set("baz", "quxx");
REQUIRE(a.get("foo") == "bar");
// Verify copies are distinct
b = a;
a.set("foo", "");
REQUIRE(b.get("foo") == "bar");
REQUIRE(a.get("foo") == "");
// Verify merkle hashes are canonical and unique
c.set("Hello", "World");
c.set("baz", "quxx");
REQUIRE(a.merkle() == c.merkle());
REQUIRE(a.merkle() != b.merkle());
// Verify size works
REQUIRE(a.size() == 2);
REQUIRE(b.size() == 3);
REQUIRE(c.size() == 2);
}
TEST_CASE("Simple ptree serialization", "[ptree]") {
ptree a;
ptree b;
// Set some values
a.set("Hello", "World");
a.set("foo", "bar");
a.set("baz", "quxx");
示例2: set
void ptree_root::set(const ptree& pt)
{
merkle = pt.merkle();
size = pt.size();
}