本文整理汇总了C++中boost::property_tree::ptree::sort方法的典型用法代码示例。如果您正苦于以下问题:C++ ptree::sort方法的具体用法?C++ ptree::sort怎么用?C++ ptree::sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::property_tree::ptree
的用法示例。
在下文中一共展示了ptree::sort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ifs
vector<shared_ptr<Program>> GeneratorStage::createPrograms(boost::property_tree::ptree& programTree, std::mt19937_64& randomEngine) {
/*if (inputName != "") {
ifstream ifs(inputName);
return readPrograms(*game, gameType, programType, ifs);
}*/
programTree = cpputil::solveReference(config, programTree);
programTree.sort();
string programName = programTree.rbegin()->first;
pt::ptree concreteProgramTree = programTree.rbegin()->second;
/*if (programName == "GraycodeMapping") {
for (int i = 0; i < programNum; ++i) {
shared_ptr<GrayCodeMapping> gray = make_shared<GrayCodeMapping>(game.getProgramType());
gray->randomize(randomEngine);
programs.push_back(gray);
}
}*/
/*} else if (programName == "ExpressionTree") {
vector<shared_ptr<ExpressionTree>> ps = ExpressionTree::generate(game->getProgramType(), concreteProgramTree, size, randomEngine);
for (shared_ptr<ExpressionTree> p : ps) {
programs.push_back(p);
}
} else if (programName == "InstructionSequence") {
for (int i = 0; i < size; ++i) {
programs.push_back(make_shared<InstructionSequence>(game->getProgramType(), concreteProgramTree, size, randomEngine));
}
} else if (programName == "FeedforwardNetwork") {*/
vector<shared_ptr<Program>> programs;
auto global = Reflection::get_mutable_instance().getGlobal();
auto theClass = global->getScope(programName);
auto genOp = theClass->getFunction<std::vector<std::shared_ptr<Program>>(const ProgramType&, const boost::property_tree::ptree&, int size, std::mt19937_64&)>("generate");
programs = vector<shared_ptr<Program>>(genOp(game->getProgramType(), concreteProgramTree, size, randomEngine));
cerr << "Program: " << programName << endl;
this->programName = programName;
return programs;
}