object
A dynamically sized associative container of JSON key/value pairs.
Synopsis
Defined in header <boost/json/object.hpp>.
class object;
Types
Name | Description |
---|---|
Associated Allocator |
|
A const random access iterator to an element. |
|
A const pointer to an element. |
|
A const reference to an element. |
|
A const reverse random access iterator to an element. |
|
The type used to represent signed integers. |
|
A random access iterator to an element. |
|
The type of keys. |
|
The type of mapped values. |
|
A pointer to an element. |
|
A reference to an element. |
|
A reverse random access iterator to an element. |
|
The type used to represent unsigned integers. |
|
The element type. |
Member Functions
Name | Description |
---|---|
Access the specified element, with bounds checking. |
|
Return an iterator to the first element. |
|
Return the number of elements that can be held in currently allocated memory. |
|
Return a const iterator to the first element. |
|
Return a const iterator to the element following the last element. |
|
Erase all elements. |
|
Return |
|
Count the number of elements with a specific key. |
|
Return a const reverse iterator to the first element of the reversed container. |
|
Return a const reverse iterator to the element following the last element of the reversed container. |
|
Construct an element in-place. |
|
Return whether there are no elements. |
|
Return an iterator to the element following the last element. |
|
Erase an element. |
|
Find an element with a specific key. |
|
Return the associated allocator. |
|
Return a pointer to the value if the key is found, or null. |
|
Insert elements. |
|
Insert an element or assign to the current element if the key already exists. |
|
|
Default constructor. |
Copy assignment. |
|
Access or insert the specified element. |
|
Return a reverse iterator to the first element of the reversed container. |
|
Return a reverse iterator to the element following the last element of the reversed container. |
|
Increase the capacity to at least a certain amount. |
|
Return the number of elements. |
|
Erase an element preserving order. |
|
Return the associated memory resource. |
|
Swap two objects. |
|
Access the specified element, with bounds checking. |
|
|
Destructor. |
Static Member Functions
Name | Description |
---|---|
Return the maximum number of elements any object can hold. |
Friends
Name | Description |
---|---|
Return |
|
Serialize |
|
Return |
|
Swap two objects. |
Description
This is an associative container whose elements are key/value pairs with unique keys.
The elements are stored contiguously; iterators are ordinary pointers, allowing random access pointer arithmetic for retrieving elements. In addition, the container maintains an internal index to speed up find operations, reducing the average complexity for most lookups and insertions.
Reallocations are usually costly operations in terms of performance, as elements are copied and the internal index must be rebuilt. The reserve
function can be used to eliminate reallocations if the number of elements is known beforehand.
Allocators
All elements stored in the container, and their children if any, will use the same memory resource that was used to construct the container.
Thread Safety
Non-const member functions may not be called concurrently with any other member functions.
Satisfies
Convenience header <boost/json.hpp>.