Using boost property tree to read int array

前端 未结 2 1901
甜味超标
甜味超标 2020-12-29 04:30

I have some JSON with a handful of integer array variables, like so:

{\"a\": [8, 6, 2], \"b\": [2, 2, 1]}

I would like to use boost propert

2条回答
  •  生来不讨喜
    2020-12-29 05:01

    Read your a list as follows:

    #include 
    BOOST_FOREACH(boost::property_tree::ptree::value_type &v, pt.get_child("a.")) {
        cout << v.second.data() << endl;
    }
    

提交回复
热议问题