PropertyTreeのptreeをiterationする
ちょっと調べたのでメモです.
以下の様なiniファイルのKeywordsを順番にiterationしていくのが目的です.
// trends.ini
[Keywords]
触手 = 秋猫
しまぱん = 桜花
縞ぱん = 桜花
縞パン = 桜花
#include <iostream> #include <boost/property_tree/ini_parser.hpp> namespace ptl = boost::property_tree; int main(){ ptl::ptree pt; read_ini("trends.ini", pt); const auto& keywords = pt.get_child("Keywords"); auto it = keywords.begin(); const auto end = keywords.end(); for(; it!=end; ++it) std::cout << it->first << " : " << it->second.data() << std::endl; // 触手 : 秋猫 // しまぱん : 桜花 // 縞ぱん : 桜花 // 縞パン : 桜花 }
・・・終わりです><.