C ++: Comment créer un tableau en utilisant boost :: property_tree?

Je ne vois pas une façon de créer un tableau à l'aide de boost::propriété de l'arbre. Le code suivant ...

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>

#include <iostream>

int main()
{
  try {
    boost::property_tree::ptree props;
    props.push_back(std::make_pair("foo", "bar"));
    props.push_back(std::make_pair("foo", "baz"));
    boost::property_tree::write_json("prob.json", props);
  } catch (const std::exception & ex) {
    std::cout << ex.what() << std::endl;
  }
}

... me donne juste ...

{
  "foo": "bar",
  "foo": "baz"
}

Docs sur boost::property_tree sont rares. Comment puis-je créer un tableau JSON avec boost::property_tree?

source d'informationauteur Jan Deinhard | 2010-09-20