sonic-cpp icon indicating copy to clipboard operation
sonic-cpp copied to clipboard

Add more examples for Document API

Open liuq19 opened this issue 2 years ago • 0 comments

We need to add more examples for Document API into example directory

The example should be like follows:

#include <iostream>
#include <string>

#include "sonic/sonic.h"

int main() {
  using NodeType = sonic_json::Node;
  using Allocator = typename NodeType::AllocatorType;
  sonic_json::Node node;
  Allocator alloc;

  node.SetObject();
  node.AddMember("Key", NodeType("Value", alloc), alloc);
  std::cout << "Add member successfully!\n";
  return 0;
}
// g++ -I../include/ -march=haswell --std=c++11 get_and_set.cpp -o get_and_set

liuq19 avatar May 11 '23 12:05 liuq19