Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

value

The type used to represent any JSON value.

Synopsis

Defined in header <boost/json/value.hpp>

class value
Types

Name

Description

allocator_type

The type of Allocator returned by get_allocator.

Member Functions

Name

Description

as_array

Return a reference to the underlying array, or throw an exception.

as_bool

Return a reference to the underlying bool, or throw an exception.

Return the underlying bool, or throw an exception.

as_double

Return a reference to the underlying double, or throw an exception.

Return the underlying double, or throw an exception.

as_int64

Return a reference to the underlying std::int64_t, or throw an exception.

Return the underlying std::int64_t, or throw an exception.

as_object

Return a reference to the underlying object, or throw an exception.

as_string

Return a reference to the underlying string, or throw an exception.

as_uint64

Return a reference to the underlying std::uint64_t, or throw an exception.

Return the underlying std::uint64_t, or throw an exception.

at

Access an element, with bounds checking.

emplace_array

Return a reference to an array, changing the kind and replacing the contents.

emplace_bool

Return a reference to a bool, changing the kind and replacing the contents.

emplace_double

Return a reference to a double, changing the kind and replacing the contents.

emplace_int64

Return a reference to a std::int64_t, changing the kind and replacing the contents.

emplace_null

Change the kind to null, discarding the previous contents.

emplace_object

Return a reference to an object, changing the kind and replacing the contents.

emplace_string

Return a reference to a string, changing the kind and replacing the contents.

emplace_uint64

Return a reference to a std::uint64_t, changing the kind and replacing the contents.

get_allocator

Return the associated memory_resource.

get_array

Return a reference to the underlying array, without checking.

get_bool

Return a reference to the underlying bool, without checking.

Return the underlying bool, without checking.

get_double

Return a reference to the underlying double, without checking.

Return the underlying double, without checking.

get_int64

Return a reference to the underlying std::int64_t, without checking.

Return the underlying std::int64_t, without checking.

get_object

Return a reference to the underlying object, without checking.

get_string

Return a reference to the underlying string, without checking.

get_uint64

Return a reference to the underlying std::uint64_t, without checking.

Return the underlying std::uint64_t, without checking.

if_array

Return an array pointer if this is an array, else return nullptr

if_bool

Return a bool pointer if this is a boolean, else return nullptr

if_double

Return a double pointer if this is a double, else return nullptr

if_int64

Return an int64_t pointer if this is a signed integer, else return nullptr

if_object

Return an object pointer if this is an object, else return nullptr

if_string

Return a string pointer if this is a string, else return nullptr

if_uint64

Return a uint64_t pointer if this is an unsigned integer, else return nullptr

is_array

Return true if this is an array.

is_bool

Return true if this is a bool.

is_double

Return true if this is a double.

is_int64

Return true if this is a signed integer.

is_null

Returns true if this is a null.

is_number

Returns true if this is a number.

is_object

Return true if this is an object.

is_primitive

Returns true if this is not an array or object.

is_string

Return true if this is a string.

is_structured

Returns true if this is an array or object.

is_uint64

Return true if this is a unsigned integer.

kind

Returns the kind of this JSON value.

operator=

Assignment.

Copy assignment.

Move assignment.

storage

Return the memory resource associated with the value.

swap

Swap the given values.

to_number

Return the stored number cast to an arithmetic type.

value [constructor]

Default constructor.

Constructor.

Pilfer constructor.

Copy constructor.

Move constructor.

Construct a null.

Construct a bool.

Construct a std::int64_t.

Construct a std::uint64_t.

Construct a double.

Construct a string.

Construct an array.

Construct an object.

Construct from an initializer-list.

~value [destructor]

Destructor.

Friends

Name

Description

operator!=

Return true if two values are not equal.

operator==

Return true if two values are equal.

swap

Swap the given values.

Description

This is a Regular. Regular type which works like a variant of the basic JSON data types: array, object, string, number, boolean, and null.

Thread Safety

Distinct instances may be accessed concurrently. Non-const member functions of a shared instance may not be called concurrently with any other member functions of that instance.

Convenience header <boost/json.hpp>


PrevUpHomeNext