26 using key_type = json::key_type;
27 using mapped_type = json;
28 using value_type = std::pair<const key_type, mapped_type>;
29 using size_type = size_t;
30 using iterator = json::object_iterator;
31 using const_iterator = json::const_object_iterator;
33 object_type() =
default;
34 object_type(
const object_type& o) : json_(o) {}
35 explicit object_type(
const json& j) : json_(j) {}
36 explicit object_type(object_type&& o) noexcept : json_(std::move(o)) {}
37 ~object_type() =
default;
39 object_type& operator=(
const object_type& o) {
44 object_type& operator=(object_type&& o)
noexcept {
45 json_ = std::move(o.json_);
50 mapped_type& operator[](
const key_type& key) {
return json_[key]; }
53 const mapped_type& at(
const key_type& key)
const {
return json_.at(key); }
56 size_type count(
const key_type& key)
const {
return json_.count(key); }
58 iterator begin() {
return json_.object_range().begin(); }
59 iterator end() {
return json_.object_range().end(); }
60 const_iterator begin()
const {
return json_.object_range().cbegin(); }
61 const_iterator end()
const {
return json_.object_range().cend(); }
62 const_iterator cbegin()
const {
return json_.object_range().cbegin(); }
63 const_iterator cend()
const {
return json_.object_range().cend(); }
70 using value_type = json;
71 using size_type = size_t;
72 using iterator = json::array_iterator;
73 using const_iterator = json::const_array_iterator;
75 array_type() =
default;
76 array_type(
const array_type& a) : json_(a) {}
77 explicit array_type(
const json& j) : json_(j) {}
78 explicit array_type(array_type&& a) noexcept : json_(std::move(a)) {}
79 template<
typename Iterator>
80 array_type(Iterator first, Iterator last) {
81 json_ = json::array();
82 for (
auto it = first; it != last; ++it) {
86 ~array_type() =
default;
88 array_type& operator=(
const array_type& o) {
93 array_type& operator=(array_type&& o)
noexcept {
94 json_ = std::move(o.json_);
98 value_type& operator[](size_type index) {
return json_[index]; }
100 const value_type& at(size_type index)
const {
return json_.at(index); }
102 value_type
const& front()
const {
return json_.at(0); }
104 void push_back(
const value_type& val) { json_.push_back(val); }
106 iterator begin() {
return json_.array_range().begin(); }
107 iterator end() {
return json_.array_range().end(); }
108 const_iterator begin()
const {
return json_.array_range().cbegin(); }
109 const_iterator end()
const {
return json_.array_range().cend(); }
110 const_iterator cbegin()
const {
return json_.array_range().cbegin(); }
111 const_iterator cend()
const {
return json_.array_range().cend(); }