[#BloombergLP-bdljsn-JsonArray] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdljsn.adoc[bdljsn]::JsonArray :relfileprefix: ../../ :mrdocs: This type is designed to replicate much of the standard sequence container interface, eliding interfaces that are less relevant for a non‐generic container. Note that a `bsl::vector` is chosen for the implementation because our implementation permits the element type to be incomplete (when just spelling the type name). == Synopsis Declared in `<bdljsn_json.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class JsonArray; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdljsn/JsonArray/ConstIterator.adoc[`ConstIterator`] | This `typedef` is an alias for `ConstIterator`. | xref:BloombergLP/bdljsn/JsonArray/Iterator-0d.adoc[`Iterator`] | This `typedef` is an alias to `Elements::iterator`. | xref:BloombergLP/bdljsn/JsonArray/const_iterator.adoc[`const_iterator`] | This `typedef` is an alias to `Elements::const_iterator`. | xref:BloombergLP/bdljsn/JsonArray/const_reference.adoc[`const_reference`] | This `typedef` is an alias for `const_reference`. | xref:BloombergLP/bdljsn/JsonArray/difference_type.adoc[`difference_type`] | This `typedef` is an alias to `Elements::difference_type`. | xref:BloombergLP/bdljsn/JsonArray/iterator-05.adoc[`iterator`] | This `typedef` is an alias to `Elements::iterator`. | xref:BloombergLP/bdljsn/JsonArray/reference.adoc[`reference`] | This `typedef` is an alias for `reference`. | xref:BloombergLP/bdljsn/JsonArray/size_type.adoc[`size_type`] | This `typedef` is an alias to `Elements::size_type`. | xref:BloombergLP/bdljsn/JsonArray/value_type.adoc[`value_type`] | This `typedef` is an alias for `value_type`. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdljsn/JsonArray/2constructor-0e.adoc[`JsonArray`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdljsn/JsonArray/operator_assign-04.adoc[`operator=`] | Assignment operators | xref:BloombergLP/bdljsn/JsonArray/allocator.adoc[`allocator`] | Return the allocator used by this object to allocate memory. | xref:BloombergLP/bdljsn/JsonArray/assign-02.adoc[`assign`] | `assign` overloads | xref:BloombergLP/bdljsn/JsonArray/back-068.adoc[`back`] | `back` overloads | xref:BloombergLP/bdljsn/JsonArray/begin-0e.adoc[`begin`] | `begin` overloads | xref:BloombergLP/bdljsn/JsonArray/cbegin.adoc[`cbegin`] | Return an iterator providing non‐modifiable access to the first element in this `JsonArray`, and the past‐the‐end iterator if this `JsonArray` is empty. | xref:BloombergLP/bdljsn/JsonArray/cend.adoc[`cend`] | Return the past‐the‐end iterator providing non‐modifiable access to this `JsonArray`. | xref:BloombergLP/bdljsn/JsonArray/clear.adoc[`clear`] | Remove all elements from this `JsonArray` making its size 0. Note that although this `JsonArray` is empty after this method returns, it preserves the same capacity it had before the method was called. | xref:BloombergLP/bdljsn/JsonArray/empty.adoc[`empty`] | Return `true` if this `JsonArray` has size 0, and `false` otherwise. | xref:BloombergLP/bdljsn/JsonArray/end-01.adoc[`end`] | `end` overloads | xref:BloombergLP/bdljsn/JsonArray/erase-0b.adoc[`erase`] | `erase` overloads | xref:BloombergLP/bdljsn/JsonArray/front-01.adoc[`front`] | `front` overloads | xref:BloombergLP/bdljsn/JsonArray/insert-0e4.adoc[`insert`] | `insert` overloads | xref:BloombergLP/bdljsn/JsonArray/maxSize.adoc[`maxSize`] | Return a theoretical upper bound on the largest number of elements that this `JsonArray` could possibly hold. Requests to create a `JsonArray` longer than this number of elements are guaranteed to raise a `bsl::length_error` exception. Note that there is no guarantee that the `JsonArray` can successfully grow to the returned size, or even close to that size, without running out of resources. | xref:BloombergLP/bdljsn/JsonArray/operator_subs-0b.adoc[`operator[]`] | Subscript operators | xref:BloombergLP/bdljsn/JsonArray/popBack.adoc[`popBack`] | Erase the last element from this `JsonArray`. The behavior is undefined if this `JsonArray` is empty. | xref:BloombergLP/bdljsn/JsonArray/print.adoc[`print`] | Write the value of this object to the specified output `stream` in a human‐readable format, and return a reference to `stream`. Optionally specify an initial indentation `level`, whose absolute value is incremented recursively for nested objects. If `level` is specified, optionally specify `spacesPerLevel`, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If `level` is negative, suppress indentation of the first line. If `spacesPerLevel` is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by `level`). If `stream` is not valid on entry, this operation has no effect. Note that this human‐readable format is not fully specified, and can change without notice. | xref:BloombergLP/bdljsn/JsonArray/pushBack-0b8.adoc[`pushBack`] | `pushBack` overloads | xref:BloombergLP/bdljsn/JsonArray/resize-00.adoc[`resize`] | `resize` overloads | xref:BloombergLP/bdljsn/JsonArray/size.adoc[`size`] | Return the number of elements in this `JsonArray`. | xref:BloombergLP/bdljsn/JsonArray/swap.adoc[`swap`] | Exchange the value of this object with that of the specified `other` object. If an exception is thrown, both objects are left in valid but unspecified states. This operation guarantees O[1]complexity. The behavior is undefined unless this object was created with the same allocator as `other`. | xref:BloombergLP/bdljsn/JsonArray/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<JsonArray, HasPrintMethod>`] | Process the specified `array` during visitation of a `bdljsn::Json` object. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bdljsn/swap-02.adoc[BloombergLP::bdljsn::swap]` | Exchange the value of the specified `a` `JsonArray` with that of the specified `b` `JsonArray`. This function provides the no‐throw exception‐safety guarantee. This operation has O[1]complexity if `a` was created with the same allocator as `b`; otherwise, it has O[n+m] complexity, where n and m are the number of elements in `a` and `b`, respectively. | `xref:BloombergLP/bdljsn/operator_not_eq-01ca.adoc[BloombergLP::bdljsn::operator!=]` | Return `false` if the specified `lhs` and `rhs` objects have the same value, and `true` otherwise. Two `JsonArray` objects `lhs` and `rhs` have the same value if they have the same number of elements, and each element in the ordered sequence of elements of `lhs` has the same value as the corresponding element in the ordered sequence of elements of `rhs`. | `xref:BloombergLP/bdljsn/operator_eq-061.adoc[BloombergLP::bdljsn::operator==]` | Return `true` if the specified `lhs` and `rhs` objects have the same value, and `false` otherwise. Two `JsonArray` objects `lhs` and `rhs` have the same value if they have the same number of elements, and each element in the ordered sequence of elements of `lhs` has the same value as the corresponding element in the ordered sequence of elements of `rhs`. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdljsn/operator_not_eq-01d.adoc[`operator!=`] | Return `true` if the specified `lhs` and `rhs` arguments do not have the same value, and `false` otherwise. Two arguments do not have the same value if the `Json` object does not have the same value as a `Json` object constructed from the other argument. | xref:BloombergLP/bdljsn/operator_eq-0dd1.adoc[`operator==`] | Return `true` if the specified `lhs` and `rhs` arguments have the same value, and `false` otherwise. Two arguments have the same value if the `Json` object has the same value as a `Json` object constructed from the other argument. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#