JSON Voorhees
Killer JSON for C++
Loading...
Searching...
No Matches
jsonv::value Class Reference

Represents a single JSON value, which can be any one of a potential kind, each behaving slightly differently. More...

#include <jsonv/value.hpp>

Classes

struct  basic_array_iterator
 The base type for iterating over array values. More...
 
struct  basic_object_iterator
 The base iterator type for iterating over object types. More...
 
struct  basic_object_reference
 What dereferencing an object_iterator (TValue of value) or a const_object_iterator (TValue of const value) gives: references to the key and value of one member. More...
 
struct  object_insert_return_type
 Type returned from insert operations when this has kind::object. More...
 

Public Types

typedef std::size_t size_type
 
typedef std::ptrdiff_t difference_type
 
typedef basic_array_iterator< value, value > array_iterator
 The array_iterator is applicable when kind is kind::array.
 
typedef basic_array_iterator< const value, const value > const_array_iterator
 
typedef detail::basic_view< array_iterator, const_array_iterator > array_view
 If kind is kind::array, an array_view allows you to access a value as a sequence container.
 
typedef detail::basic_view< const_array_iterator > const_array_view
 
typedef detail::basic_owning_view< value, array_iterator, const_array_iterator > owning_array_view
 
typedef std::pair< const std::string, value > object_value_type
 The type of value stored when kind is kind::object, as an owning pair.
 
typedef basic_object_reference< value > object_reference
 
typedef basic_object_reference< const value > const_object_reference
 
typedef basic_object_iterator< value, std::pair< std::string, value > > object_iterator
 The object_iterator is applicable when kind is kind::object.
 
typedef basic_object_iterator< const value, const std::pair< std::string, value > > const_object_iterator
 
typedef detail::basic_view< object_iterator, const_object_iterator > object_view
 If kind is kind::object, an object_view allows you to access a value as an associative container.
 
typedef detail::basic_view< const_object_iterator > const_object_view
 
typedef detail::basic_owning_view< value, object_iterator, const_object_iterator > owning_object_view
 

Public Member Functions

constexpr value ()=default
 Default-construct this to null.
 
 value (std::nullptr_t)=delete
 The nullptr overload will fail to compile – use jsonv::null if you want a kind::null.
 
 value (const value &source)
 Copy the contents of source into a new instance.
 
 value (const std::string &value)
 Create a kind::string with the given value.
 
 value (const std::string_view &value)
 Create a kind::string with the given value.
 
 value (const char *value)
 Create a kind::string with the given value.
 
 value (const std::wstring &value)
 Create a kind::string with the given value.
 
 value (const wchar_t *value)
 Create a kind::string with the given value.
 
 value (int64_t value)
 Create a kind::integer with the given value.
 
 value (double value)
 Create a kind::decimal with the given value.
 
 value (float value)
 Create a kind::decimal with the given value.
 
 value (bool value)
 Create a kind::boolean with the given value.
 
 ~value () noexcept
 Destruction will never throw.
 
value & operator= (const value &source)
 Copy-assigns source to this.
 
 value (value &&source) noexcept
 Move-construct this instance, leaving source as a null value.
 
value & operator= (value &&source) noexcept
 Move-assigns source to this, leaving source as a null value.
 
std::string_view as_string () const
 Get this value as a string.
 
bool is_string () const
 Tests if this kind is kind::string.
 
std::string_view as_string_view () const &
 The same as as_string.
 
std::wstring as_wstring () const
 Get this value as a wide string.
 
int64_t as_integer () const
 Get this value as an integer.
 
bool is_integer () const
 Tests if this kind is kind::integer.
 
double as_decimal () const
 Get this value as a decimal.
 
bool is_decimal () const
 Tests if this kind is kind::integer or kind::decimal.
 
bool as_boolean () const
 Get this value as a boolean.
 
bool is_boolean () const
 Tests if this kind is kind::boolean.
 
bool is_array () const
 Tests if this kind is kind::array.
 
bool is_object () const
 Tests if this kind is kind::object.
 
bool is_null () const
 Tests if this kind is kind::null.
 
void clear ()
 Resets this value to null.
 
jsonv::kind kind () const
 Get this value's kind.
 
void swap (value &other) noexcept
 Swap the value this instance represents with other.
 
bool operator== (const value &other) const
 Compares two JSON values for equality.
 
bool operator!= (const value &other) const
 Compares two JSON values for inequality.
 
int compare (const value &other) const
 Used to build a strict-ordering of JSON values.
 
bool operator< (const value &other) const
 
bool operator> (const value &other) const
 
bool operator<= (const value &other) const
 
bool operator>= (const value &other) const
 
void pop_back ()
 Pop an item off the back of this array.
 
array_iterator insert (const_array_iterator position, value item)
 Insert an item into position on this array.
 
template<typename TForwardIterator >
array_iterator insert (const_array_iterator position, TForwardIterator first, TForwardIterator last)
 Insert the range defined by [first, last) at position in this array.
 
void assign (size_type count, const value &val)
 Assign count elements to this array with val.
 
template<typename TForwardIterator >
void assign (TForwardIterator first, TForwardIterator last)
 Assign the contents of range [first, last) to this array.
 
void assign (std::initializer_list< value > items)
 Assign the given items to this array.
 
void reserve (size_type count)
 Reserve at least count elements in the array.
 
void resize (size_type count, const value &val=value())
 Resize the length of this array to count items.
 
array_iterator erase (const_array_iterator position)
 Erase the item at this array's position.
 
array_iterator erase (const_array_iterator first, const_array_iterator last)
 Erase the range [first, last) from this array.
 
template<typename TForwardIterator >
void insert (TForwardIterator first, TForwardIterator last)
 Insert range defined by [first, last) into this object.
 
object_insert_return_type insert (object_node_handle &&handle)
 Insert the contents of handle.
 
object_iterator insert (const_object_iterator hint, object_node_handle &&handle)
 If handle is an empty node handle, does nothing and returns end_object.
 
object_iterator erase (const_object_iterator position)
 Erase the item at the given position.
 
object_iterator erase (const_object_iterator first, const_object_iterator last)
 Erase the range defined by [first, last).
 
object_node_handle extract (const_object_iterator position)
 Move the key and value of the member at position into a node handle, erase the member, and return the handle.
 
bool empty () const noexcept
 Is the underlying structure empty?
 
size_type size () const
 Get the number of items in this value.
 
value map (const std::function< value(const value &)> &func) const &
 Run a function over the values of this instance.
 
value map (const std::function< value(value)> &func) &&
 Run a function over the values of this instance.
 
value & at_path (const path &p)
 Get the value specified by the path p.
 
value & at_path (std::string_view p)
 Get the value specified by the path p.
 
value & at_path (size_type p)
 Get the value specified by the path p.
 
const value & at_path (const path &p) const
 Get the value specified by the path p.
 
const value & at_path (std::string_view p) const
 Get the value specified by the path p.
 
const value & at_path (size_type p) const
 Get the value specified by the path p.
 
size_type count_path (const path &p) const
 Similar to count, but walks the given path p to determine its presence.
 
size_type count_path (std::string_view p) const
 Similar to count, but walks the given path p to determine its presence.
 
size_type count_path (size_type p) const
 Similar to count, but walks the given path p to determine its presence.
 
value & path (const path &p)
 Get or create the value specified by the path p.
 
value & path (std::string_view p)
 Get or create the value specified by the path p.
 
value & path (size_type p)
 Get or create the value specified by the path p.
 
array_iterator begin_array ()
 Get an iterator to the beginning of this array.
 
const_array_iterator begin_array () const
 Get an iterator to the beginning of this array.
 
array_iterator end_array ()
 Get an iterator to the end of this array.
 
const_array_iterator end_array () const
 Get an iterator to the end of this array.
 
array_view as_array () &
 View this instance as an array.
 
const_array_view as_array () const &
 View this instance as an array.
 
owning_array_view as_array () &&
 View this instance as an array.
 
value & operator[] (size_type idx)
 Get the value in this array at the given idx.
 
const value & operator[] (size_type idx) const
 Get the value in this array at the given idx.
 
value & operator[] (int idx)
 Get the value in this array at the given idx.
 
const value & operator[] (int idx) const
 Get the value in this array at the given idx.
 
value & at (size_type idx)
 Get the value in this array at the given idx.
 
const value & at (size_type idx) const
 Get the value in this array at the given idx.
 
void push_back (value &&item)
 Push item to the back of this array.
 
void push_back (const value &item)
 Push item to the back of this array.
 
object_iterator begin_object ()
 Get an iterator to the first key-value pair in this object.
 
const_object_iterator begin_object () const
 Get an iterator to the first key-value pair in this object.
 
object_iterator end_object ()
 Get an iterator to the one past the end of this object.
 
const_object_iterator end_object () const
 Get an iterator to the one past the end of this object.
 
object_view as_object () &
 View this instance as an object.
 
const_object_view as_object () const &
 View this instance as an object.
 
owning_object_view as_object () &&
 View this instance as an object.
 
value & operator[] (const std::string &key)
 Get the value associated with the given key of this object.
 
value & operator[] (std::string &&key)
 Get the value associated with the given key of this object.
 
value & operator[] (const std::wstring &key)
 Get the value associated with the given key of this object.
 
value & at (const std::string &key)
 Get the value associated with the given key of this object.
 
value & at (const std::wstring &key)
 Get the value associated with the given key of this object.
 
const value & at (const std::string &key) const
 Get the value associated with the given key of this object.
 
const value & at (const std::wstring &key) const
 Get the value associated with the given key of this object.
 
size_type count (const std::string &key) const
 Check if the given key exists in this object.
 
size_type count (const std::wstring &key) const
 Check if the given key exists in this object.
 
object_iterator find (const std::string &key)
 Attempt to locate a key-value pair with the provided key in this object.
 
object_iterator find (const std::wstring &key)
 Attempt to locate a key-value pair with the provided key in this object.
 
const_object_iterator find (const std::string &key) const
 Attempt to locate a key-value pair with the provided key in this object.
 
const_object_iterator find (const std::wstring &key) const
 Attempt to locate a key-value pair with the provided key in this object.
 
std::pair< object_iterator, bool > insert (std::pair< std::string, value > pair)
 Insert pair into this object, unless an element with an equivalent key is already present.
 
std::pair< object_iterator, bool > insert (std::pair< std::wstring, value > pair)
 Insert pair into this object, unless an element with an equivalent key is already present.
 
object_iterator insert (const_object_iterator hint, std::pair< std::string, value > pair)
 Insert pair into this object, unless an element with an equivalent key is already present.
 
object_iterator insert (const_object_iterator hint, std::pair< std::wstring, value > pair)
 Insert pair into this object, unless an element with an equivalent key is already present.
 
void insert (std::initializer_list< std::pair< std::string, value > > items)
 Insert items into this object.
 
void insert (std::initializer_list< std::pair< std::wstring, value > > items)
 Insert items into this object.
 
std::pair< object_iterator, bool > emplace (std::string key, value val)
 Construct an element from key and val and insert it into this object.
 
std::pair< object_iterator, bool > emplace (const std::wstring &key, value val)
 Construct an element from key and val and insert it into this object.
 
std::pair< object_iterator, bool > try_emplace (const std::string &key, value val)
 Insert val with the given key into this object, but only if no element with an equivalent key is already present.
 
std::pair< object_iterator, bool > try_emplace (const std::wstring &key, value val)
 Insert val with the given key into this object, but only if no element with an equivalent key is already present.
 
std::pair< object_iterator, bool > insert_or_assign (const std::string &key, value val)
 Insert val with the given key into this object if no element with an equivalent key is present; otherwise, assign val to the existing element.
 
std::pair< object_iterator, bool > insert_or_assign (const std::wstring &key, value val)
 Insert val with the given key into this object if no element with an equivalent key is present; otherwise, assign val to the existing element.
 
size_type erase (const std::string &key)
 Erase the item with the given key.
 
size_type erase (const std::wstring &key)
 Erase the item with the given key.
 
object_node_handle extract (const std::string &key)
 If the container has an element with the given key, moves its key and value into a node handle, erases it, and returns the handle.
 
object_node_handle extract (const std::wstring &key)
 If the container has an element with the given key, moves its key and value into a node handle, erases it, and returns the handle.
 

Friends

std::ostream & operator<< (std::ostream &stream, const value &val)
 Output this value to a stream, through an ostream_encoder.
 
std::string to_string (const value &)
 Get a string representation of the given value.
 
JSONV_PUBLIC value array ()
 Create an empty array value.
 
JSONV_PUBLIC value object ()
 Create an empty object.
 

Detailed Description

Represents a single JSON value, which can be any one of a potential kind, each behaving slightly differently.

Instances will vary their behavior based on their kind – functions will throw a kind_error if the operation does not apply to the value's kind. For example, it does not make sense to call find on an integer.

  • kind::null You cannot do anything with this...it is just null.
  • kind::boolean These values can be true or false.
  • kind::integer A numeric value which can be added, subtracted and all the other things you would expect.
  • kind::decimal Floating-point values should be considered "more general" than integers – you may request an integer value as a decimal, but you cannot request a decimal as an integer, even when doing so would not require rounding. The literal 20.0 will always have kind::decimal.
  • kind::string A UTF-8 encoded string, read through the std::string_view which as_string returns. Some random functions work in the cases where it makes sense (for example: empty and size), but in general, string manipulation should be done after calling as_string. A string of up to 14 bytes is kept in the value itself, and a longer one in a single allocation of its own.
  • kind::array An array behaves like a std::vector: its elements are contiguous, growing it may move them all, and inserting or erasing shifts the elements after the position. Element references are invalidated when std::vector's would be. The elements share one allocation with the array's size and capacity, and an empty array may hold no allocation at all. If you feel the documentation is lacking, read this: http://en.cppreference.com/w/cpp/container/vector.
  • kind::object An object behaves like a std::flat_map: its members are kept sorted by key in one contiguous array, so it iterates in key order, looking a key up is a binary search, and inserting or erasing shifts the members after the position and invalidates iterators and references to them. Dereferencing an object_iterator gives an object_reference, a proxy like std::flat_map::reference. The members share one allocation with the object's size and capacity, and an empty object may hold no allocation at all. If you feel the documentation is lacking, read this: http://en.cppreference.com/w/cpp/container/flat_map. This library follows the recommendation in RFC 7159 to not allow for duplicate keys because most other libraries can not deal with it. It would also make the AST significantly more painful.
Nesting depth
Destroying a value, clearing it, or move-assigning over one takes any depth of nesting: the tree is taken apart iteratively, not once per level on the call stack. The operations which walk a whole tree – copying it, comparing two, encoding one to text, std::hash, and the algorithm.hpp walks such as traverse, diff, map and merge – do recurse, so they cost stack in proportion to the depth of the tree and are safe to perform on a tree nested tens of thousands deep on a thread with the usual stack, and less than that on a small one. Parsing cannot build a tree deeper than parse_options::k::max_structure_depth, so this is only reachable for a tree built in code, through the mutators, path, or a value_encoder.
See also
http://json.org/
http://tools.ietf.org/html/rfc7159

Definition at line 164 of file value.hpp.


Class Documentation

◆ jsonv::value::object_insert_return_type

struct jsonv::value::object_insert_return_type

Type returned from insert operations when this has kind::object.

It is generally compatible with the insert_return_type of std::map, with the notable lack of node.

See also
insert

Definition at line 591 of file value.hpp.

+ Collaboration diagram for jsonv::value::object_insert_return_type:
Class Members
bool inserted Did the insert operation perform an insert? A value of false indicates there was a key already present with the same name.
const_object_iterator position The position of the inserted member or the member with the duplicate key.

Member Typedef Documentation

◆ array_iterator

The array_iterator is applicable when kind is kind::array.

It allows you to use algorithms as if a value was a normal sequence container.

Definition at line 327 of file value.hpp.

◆ array_view

If kind is kind::array, an array_view allows you to access a value as a sequence container.

This is most useful for range-based for loops.

Definition at line 333 of file value.hpp.

◆ const_array_iterator

Definition at line 328 of file value.hpp.

◆ const_array_view

typedef detail::basic_view<const_array_iterator> jsonv::value::const_array_view

Definition at line 334 of file value.hpp.

◆ const_object_iterator

typedef basic_object_iterator<const value, const std::pair<std::string, value> > jsonv::value::const_object_iterator

Definition at line 578 of file value.hpp.

◆ const_object_reference

◆ const_object_view

typedef detail::basic_view<const_object_iterator> jsonv::value::const_object_view

Definition at line 584 of file value.hpp.

◆ difference_type

typedef std::ptrdiff_t jsonv::value::difference_type

Definition at line 168 of file value.hpp.

◆ object_iterator

typedef basic_object_iterator<value, std::pair<std::string, value> > jsonv::value::object_iterator

The object_iterator is applicable when kind is kind::object.

It allows you to use algorithms as if a value was a normal associative container.

Definition at line 577 of file value.hpp.

◆ object_reference

◆ object_value_type

typedef std::pair<const std::string, value> jsonv::value::object_value_type

The type of value stored when kind is kind::object, as an owning pair.

Iterating an object does not give references to this type: members are stored sorted by key in contiguous memory, and an iterator gives an object_reference instead. Converting one into this type copies the member, so it has to be asked for.

Definition at line 341 of file value.hpp.

◆ object_view

If kind is kind::object, an object_view allows you to access a value as an associative container.

This is most useful for range-based for loops.

Definition at line 583 of file value.hpp.

◆ owning_array_view

typedef detail::basic_owning_view<value, array_iterator, const_array_iterator> jsonv::value::owning_array_view

Definition at line 335 of file value.hpp.

◆ owning_object_view

typedef detail::basic_owning_view<value, object_iterator, const_object_iterator> jsonv::value::owning_object_view

Definition at line 585 of file value.hpp.

◆ size_type

typedef std::size_t jsonv::value::size_type

Definition at line 167 of file value.hpp.

Constructor & Destructor Documentation

◆ value() [1/3]

jsonv::value::value ( const char *  value)

Create a kind::string with the given value.

Parameters
valueThe value to create with. This must be null-terminated.

◆ value() [2/3]

jsonv::value::value ( const std::wstring &  value)

Create a kind::string with the given value.

Keep in mind that it will be converted to and stored as a UTF-8 encoded string.

Exceptions
std::range_errorif value is not valid UTF-16, such as when it holds an unpaired surrogate or, where wchar_t is 32 bits, a code unit above 0xFFFF.

◆ value() [3/3]

jsonv::value::value ( const wchar_t *  value)

Create a kind::string with the given value.

Keep in mind that it will be converted to and stored as a UTF-8 encoded string.

Parameters
valueThe value to create with. This must be null-terminated.
Exceptions
std::range_errorif value is not valid UTF-16, such as when it holds an unpaired surrogate or, where wchar_t is 32 bits, a code unit above 0xFFFF.

Member Function Documentation

◆ as_array() [1/3]

array_view jsonv::value::as_array ( ) &

View this instance as an array.

Exceptions
kind_errorif the kind is not an array.

◆ as_array() [2/3]

owning_array_view jsonv::value::as_array ( ) &&

View this instance as an array.

Exceptions
kind_errorif the kind is not an array.

◆ as_array() [3/3]

const_array_view jsonv::value::as_array ( ) const &

View this instance as an array.

Exceptions
kind_errorif the kind is not an array.

◆ as_boolean()

bool jsonv::value::as_boolean ( ) const

Get this value as a boolean.

Exceptions
kind_errorif this value does not represent a boolean.

◆ as_decimal()

double jsonv::value::as_decimal ( ) const

Get this value as a decimal.

If the value's underlying kind is actually an integer type, cast the integer to a double before returning. This ignores the potential loss of precision.

Exceptions
kind_errorif this value does not represent a decimal or integer.

◆ as_integer()

int64_t jsonv::value::as_integer ( ) const

Get this value as an integer.

Exceptions
kind_errorif this value does not represent an integer.

◆ as_object() [1/3]

object_view jsonv::value::as_object ( ) &

View this instance as an object.

Exceptions
kind_errorif the kind is not an object.

◆ as_object() [2/3]

owning_object_view jsonv::value::as_object ( ) &&

View this instance as an object.

Exceptions
kind_errorif the kind is not an object.

◆ as_object() [3/3]

const_object_view jsonv::value::as_object ( ) const &

View this instance as an object.

Exceptions
kind_errorif the kind is not an object.

◆ as_string()

std::string_view jsonv::value::as_string ( ) const

Get this value as a string.

The view is into this value, so it is good until the value changes or goes away: auto text = parse(input).as_string(); leaves text referring to a destroyed temporary. Make a std::string from it to keep the text, or to get a NUL-terminated c_str.

Exceptions
kind_errorif this value does not represent a string.

◆ as_string_view()

std::string_view jsonv::value::as_string_view ( ) const &

The same as as_string.

It is your responsibility to ensure the value instance remains valid.

Exceptions
kind_errorif this value does not represent a string.

◆ as_wstring()

std::wstring jsonv::value::as_wstring ( ) const

Get this value as a wide string.

Keep in mind that this is slower than as_string, as the text is stored as UTF-8 and has to be converted. The result is UTF-16 even where wchar_t is 32 bits, so a code point outside the BMP takes a surrogate pair there too.

Exceptions
kind_errorif this value does not represent a string.
std::range_errorif the stored string is not valid UTF-8.

◆ assign() [1/3]

void jsonv::value::assign ( size_type  count,
const value &  val 
)

Assign count elements to this array with val.

Exceptions
kind_errorif the kind is not an array.

◆ assign() [2/3]

void jsonv::value::assign ( std::initializer_list< value >  items)

Assign the given items to this array.

Exceptions
kind_errorif the kind is not an array.

◆ assign() [3/3]

template<typename TForwardIterator >
void jsonv::value::assign ( TForwardIterator  first,
TForwardIterator  last 
)
inline

Assign the contents of range [first, last) to this array.

Exceptions
kind_errorif the kind is not an array.

Definition at line 995 of file value.hpp.

◆ at() [1/6]

value & jsonv::value::at ( const std::string &  key)

Get the value associated with the given key of this object.

Exceptions
kind_errorif the kind is not an object.
std::out_of_rangeif the key is not in this object.

◆ at() [2/6]

const value & jsonv::value::at ( const std::string &  key) const

Get the value associated with the given key of this object.

Exceptions
kind_errorif the kind is not an object.
std::out_of_rangeif the key is not in this object.

◆ at() [3/6]

value & jsonv::value::at ( const std::wstring &  key)

Get the value associated with the given key of this object.

Exceptions
kind_errorif the kind is not an object.
std::out_of_rangeif the key is not in this object.

◆ at() [4/6]

const value & jsonv::value::at ( const std::wstring &  key) const

Get the value associated with the given key of this object.

Exceptions
kind_errorif the kind is not an object.
std::out_of_rangeif the key is not in this object.

◆ at() [5/6]

value & jsonv::value::at ( size_type  idx)

Get the value in this array at the given idx.

Exceptions
kind_errorif the kind is not an array.
std::out_of_rangeif the provided idx is above size.

◆ at() [6/6]

const value & jsonv::value::at ( size_type  idx) const

Get the value in this array at the given idx.

Exceptions
kind_errorif the kind is not an array.
std::out_of_rangeif the provided idx is above size.

◆ at_path() [1/6]

value & jsonv::value::at_path ( const path &  p)

Get the value specified by the path p.

Exceptions
std::out_of_rangeif any path along the chain did not exist.
kind_errorif the path traversal is not valid for the value (for example: if the path specifies an array index when the value is a string).
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).

◆ at_path() [2/6]

const value & jsonv::value::at_path ( const path &  p) const

Get the value specified by the path p.

Exceptions
std::out_of_rangeif any path along the chain did not exist.
kind_errorif the path traversal is not valid for the value (for example: if the path specifies an array index when the value is a string).
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).

◆ at_path() [3/6]

value & jsonv::value::at_path ( size_type  p)

Get the value specified by the path p.

Exceptions
std::out_of_rangeif any path along the chain did not exist.
kind_errorif the path traversal is not valid for the value (for example: if the path specifies an array index when the value is a string).
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).

◆ at_path() [4/6]

const value & jsonv::value::at_path ( size_type  p) const

Get the value specified by the path p.

Exceptions
std::out_of_rangeif any path along the chain did not exist.
kind_errorif the path traversal is not valid for the value (for example: if the path specifies an array index when the value is a string).
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).

◆ at_path() [5/6]

value & jsonv::value::at_path ( std::string_view  p)

Get the value specified by the path p.

Exceptions
std::out_of_rangeif any path along the chain did not exist.
kind_errorif the path traversal is not valid for the value (for example: if the path specifies an array index when the value is a string).
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).

◆ at_path() [6/6]

const value & jsonv::value::at_path ( std::string_view  p) const

Get the value specified by the path p.

Exceptions
std::out_of_rangeif any path along the chain did not exist.
kind_errorif the path traversal is not valid for the value (for example: if the path specifies an array index when the value is a string).
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).

◆ begin_array() [1/2]

array_iterator jsonv::value::begin_array ( )

Get an iterator to the beginning of this array.

Exceptions
kind_errorif the kind is not an array.

◆ begin_array() [2/2]

const_array_iterator jsonv::value::begin_array ( ) const

Get an iterator to the beginning of this array.

Exceptions
kind_errorif the kind is not an array.

◆ begin_object() [1/2]

object_iterator jsonv::value::begin_object ( )

Get an iterator to the first key-value pair in this object.

Exceptions
kind_errorif the kind is not an object.

◆ begin_object() [2/2]

const_object_iterator jsonv::value::begin_object ( ) const

Get an iterator to the first key-value pair in this object.

Exceptions
kind_errorif the kind is not an object.

◆ compare()

int jsonv::value::compare ( const value &  other) const

Used to build a strict-ordering of JSON values.

When comparing values of the same kind, the ordering should align with your intuition. When comparing values of different kinds, some arbitrary rules were created based on how "complicated" the author thought the type to be.

  • null: less than everything but null, which it is equal to.
  • boolean: false is less than true.
  • integer, decimal: compared by their exact numeric value. An integer is never converted to a decimal to compare it with one, so 9007199254740993 is greater than the decimal 9007199254740992.0 even though converting it would round to that decimal. Decimal comparison is exact, without an epsilon tolerance. Signed zeros compare equal to each other and to the integer 0; infinities follow numeric order. All NaNs compare equal to each other and greater than every other number, regardless of sign or payload.
  • string: compared lexicographically by character code (with basic char strings and non-ASCII encoding, this might lead to surprising results)
  • array: compared lexicographically by elements (recursively following this same technique)
  • object: entries in the object are sorted and compared lexicographically, first by key then by value
Returns
A negative number if this is less than other by the rules stated above; 0 if this is equal to other; a positive number otherwise. Only the sign is meaningful: strings and object keys pass on the result of std::string::compare, which need not be -1 or 1.

◆ count() [1/2]

size_type jsonv::value::count ( const std::string &  key) const

Check if the given key exists in this object.

Exceptions
kind_errorif the kind is not an object.

◆ count() [2/2]

size_type jsonv::value::count ( const std::wstring &  key) const

Check if the given key exists in this object.

Exceptions
kind_errorif the kind is not an object.

◆ count_path() [1/3]

size_type jsonv::value::count_path ( const path &  p) const

Similar to count, but walks the given path p to determine its presence.

Returns
1 if the path finds an element; 0 if there is no such path in the tree.
Exceptions
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).

◆ count_path() [2/3]

size_type jsonv::value::count_path ( size_type  p) const

Similar to count, but walks the given path p to determine its presence.

Returns
1 if the path finds an element; 0 if there is no such path in the tree.
Exceptions
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).

◆ count_path() [3/3]

size_type jsonv::value::count_path ( std::string_view  p) const

Similar to count, but walks the given path p to determine its presence.

Returns
1 if the path finds an element; 0 if there is no such path in the tree.
Exceptions
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).

◆ emplace() [1/2]

std::pair< object_iterator, bool > jsonv::value::emplace ( const std::wstring &  key,
value  val 
)

Construct an element from key and val and insert it into this object.

If an element with an equivalent key is already present, the insertion does not happen and the existing element is not overwritten.

Note
key is taken by value, so a call which does not insert has still built and destroyed it. Prefer try_emplace when collisions are expected.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Returns
A pair whose first refers to the newly-inserted element (or the element which shares the key) and whose second is true if the insertion took place.
Exceptions
kind_errorif the kind is not an object.
See also
insert
try_emplace

◆ emplace() [2/2]

std::pair< object_iterator, bool > jsonv::value::emplace ( std::string  key,
value  val 
)

Construct an element from key and val and insert it into this object.

If an element with an equivalent key is already present, the insertion does not happen and the existing element is not overwritten.

Note
key is taken by value, so a call which does not insert has still built and destroyed it. Prefer try_emplace when collisions are expected.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Returns
A pair whose first refers to the newly-inserted element (or the element which shares the key) and whose second is true if the insertion took place.
Exceptions
kind_errorif the kind is not an object.
See also
insert
try_emplace

◆ empty()

bool jsonv::value::empty ( ) const
noexcept

Is the underlying structure empty?

  • object: Are there no keys?
  • array: Are there no values?
  • string: Is the string 0 length?
  • null: true (always)
  • all other types: false (always)
Exceptions
nothing

◆ end_array() [1/2]

array_iterator jsonv::value::end_array ( )

Get an iterator to the end of this array.

Exceptions
kind_errorif the kind is not an array.

◆ end_array() [2/2]

const_array_iterator jsonv::value::end_array ( ) const

Get an iterator to the end of this array.

Exceptions
kind_errorif the kind is not an array.

◆ end_object() [1/2]

object_iterator jsonv::value::end_object ( )

Get an iterator to the one past the end of this object.

Exceptions
kind_errorif the kind is not an object.

◆ end_object() [2/2]

const_object_iterator jsonv::value::end_object ( ) const

Get an iterator to the one past the end of this object.

Exceptions
kind_errorif the kind is not an object.

◆ erase() [1/6]

size_type jsonv::value::erase ( const std::string &  key)

Erase the item with the given key.

Erasing invalidates every iterator and reference to a member at or after the position erased from.

Returns
1 if key was erased; 0 if it did not.
Exceptions
kind_errorif the kind is not an object.

◆ erase() [2/6]

size_type jsonv::value::erase ( const std::wstring &  key)

Erase the item with the given key.

Erasing invalidates every iterator and reference to a member at or after the position erased from.

Returns
1 if key was erased; 0 if it did not.
Exceptions
kind_errorif the kind is not an object.

◆ erase() [3/6]

array_iterator jsonv::value::erase ( const_array_iterator  first,
const_array_iterator  last 
)

Erase the range [first, last) from this array.

Exceptions
kind_errorif the kind is not an array.

◆ erase() [4/6]

array_iterator jsonv::value::erase ( const_array_iterator  position)

Erase the item at this array's position.

Exceptions
kind_errorif the kind is not an array.

◆ erase() [5/6]

object_iterator jsonv::value::erase ( const_object_iterator  first,
const_object_iterator  last 
)

Erase the range defined by [first, last).

Erasing invalidates every iterator and reference to a member at or after the position erased from.

Returns
An iterator to the member which followed the erased range.
Exceptions
kind_errorif the kind is not an object.

◆ erase() [6/6]

object_iterator jsonv::value::erase ( const_object_iterator  position)

Erase the item at the given position.

Erasing invalidates every iterator and reference to a member at or after the position erased from.

Returns
An iterator to the member which followed the erased one.
Exceptions
kind_errorif the kind is not an object.

◆ extract() [1/3]

object_node_handle jsonv::value::extract ( const std::string &  key)

If the container has an element with the given key, moves its key and value into a node handle, erases it, and returns the handle.

Otherwise, returns an empty node handle.

Erasing invalidates every iterator and reference to a member at or after the position erased from.

Exceptions
kind_errorif the kind is not an object.

◆ extract() [2/3]

object_node_handle jsonv::value::extract ( const std::wstring &  key)

If the container has an element with the given key, moves its key and value into a node handle, erases it, and returns the handle.

Otherwise, returns an empty node handle.

Erasing invalidates every iterator and reference to a member at or after the position erased from.

Exceptions
kind_errorif the kind is not an object.

◆ extract() [3/3]

object_node_handle jsonv::value::extract ( const_object_iterator  position)

Move the key and value of the member at position into a node handle, erase the member, and return the handle.

Erasing invalidates every iterator and reference to a member at or after the position erased from.

Exceptions
kind_errorif the kind is not an object.

◆ find() [1/4]

object_iterator jsonv::value::find ( const std::string &  key)

Attempt to locate a key-value pair with the provided key in this object.

Exceptions
kind_errorif the kind is not an object.

◆ find() [2/4]

const_object_iterator jsonv::value::find ( const std::string &  key) const

Attempt to locate a key-value pair with the provided key in this object.

Exceptions
kind_errorif the kind is not an object.

◆ find() [3/4]

object_iterator jsonv::value::find ( const std::wstring &  key)

Attempt to locate a key-value pair with the provided key in this object.

Exceptions
kind_errorif the kind is not an object.

◆ find() [4/4]

const_object_iterator jsonv::value::find ( const std::wstring &  key) const

Attempt to locate a key-value pair with the provided key in this object.

Exceptions
kind_errorif the kind is not an object.

◆ insert() [1/11]

template<typename TForwardIterator >
array_iterator jsonv::value::insert ( const_array_iterator  position,
TForwardIterator  first,
TForwardIterator  last 
)
inline

Insert the range defined by [first, last) at position in this array.

Exceptions
kind_errorif the kind is not an array.

Definition at line 977 of file value.hpp.

◆ insert() [2/11]

array_iterator jsonv::value::insert ( const_array_iterator  position,
value  item 
)

Insert an item into position on this array.

Exceptions
kind_errorif the kind is not an array.

◆ insert() [3/11]

object_iterator jsonv::value::insert ( const_object_iterator  hint,
object_node_handle &&  handle 
)

If handle is an empty node handle, does nothing and returns end_object.

Otherwise, inserts the element owned by handle into the container, if the container doesn't already contain an element with a key equivalent to handle.key() and returns the iterator pointing to the element with key equivalent to handle.key(). If the insertion succeeds, handle is moved from, otherwise it retains ownership of the element. hint works as it does for insert of a pair.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Returns
An iterator pointing to an element with a key equivalent to handle.key() if handle was not empty. If handle was empty, end_object().
Exceptions
kind_errorif the kind is not an object.

◆ insert() [4/11]

object_iterator jsonv::value::insert ( const_object_iterator  hint,
std::pair< std::string, value >  pair 
)

Insert pair into this object, unless an element with an equivalent key is already present.

If hint is where the key goes – every member before it has a lesser key and hint itself a greater one – the key is not searched for. A hint of end_object for a key greater than every one present appends in amortized constant time; any other insertion shifts the members after it. A wrong hint costs a binary search.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Returns
An iterator to the newly-inserted element (or the element which shares the key).
Exceptions
kind_errorif the kind is not an object.

◆ insert() [5/11]

object_iterator jsonv::value::insert ( const_object_iterator  hint,
std::pair< std::wstring, value >  pair 
)

Insert pair into this object, unless an element with an equivalent key is already present.

If hint is where the key goes – every member before it has a lesser key and hint itself a greater one – the key is not searched for. A hint of end_object for a key greater than every one present appends in amortized constant time; any other insertion shifts the members after it. A wrong hint costs a binary search.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Returns
An iterator to the newly-inserted element (or the element which shares the key).
Exceptions
kind_errorif the kind is not an object.

◆ insert() [6/11]

object_insert_return_type jsonv::value::insert ( object_node_handle &&  handle)

Insert the contents of handle.

If handle is empty, this does nothing. If the insertion succeeds, handle is moved from and left empty; otherwise it retains ownership of the element.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Returns
If handle is empty, inserted is false and position is end_object(). If the insertion took place, inserted is true and position points to the inserted element. If the insertion was attempted but failed, inserted is false and position points to an element with a key equivalent to handle.key().
Exceptions
kind_errorif the kind is not an object.

◆ insert() [7/11]

void jsonv::value::insert ( std::initializer_list< std::pair< std::string, value > >  items)

Insert items into this object.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Exceptions
kind_errorif the kind is not an object.

◆ insert() [8/11]

void jsonv::value::insert ( std::initializer_list< std::pair< std::wstring, value > >  items)

Insert items into this object.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Exceptions
kind_errorif the kind is not an object.

◆ insert() [9/11]

std::pair< object_iterator, bool > jsonv::value::insert ( std::pair< std::string, value >  pair)

Insert pair into this object, unless an element with an equivalent key is already present.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Returns
A pair whose first refers to the newly-inserted element (or the element which shares the key) and whose second is true if the insertion took place.
Exceptions
kind_errorif the kind is not an object.

◆ insert() [10/11]

std::pair< object_iterator, bool > jsonv::value::insert ( std::pair< std::wstring, value >  pair)

Insert pair into this object, unless an element with an equivalent key is already present.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Returns
A pair whose first refers to the newly-inserted element (or the element which shares the key) and whose second is true if the insertion took place.
Exceptions
kind_errorif the kind is not an object.

◆ insert() [11/11]

template<typename TForwardIterator >
void jsonv::value::insert ( TForwardIterator  first,
TForwardIterator  last 
)
inline

Insert range defined by [first, last) into this object.

Each element is hinted just past the previous one, so a source in ascending key order needs no searching, and one whose keys all sort after what this object holds is appended in amortized constant time per element. Any element which does not go at the end shifts the members after it.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Exceptions
kind_errorif the kind is not an object.

Definition at line 1166 of file value.hpp.

◆ insert_or_assign() [1/2]

std::pair< object_iterator, bool > jsonv::value::insert_or_assign ( const std::string &  key,
value  val 
)

Insert val with the given key into this object if no element with an equivalent key is present; otherwise, assign val to the existing element.

Unlike try_emplace, val is stored either way.

Returns
A pair whose first refers to the inserted or assigned element and whose second is true if an insertion took place and false if an assignment took place. Unlike insert, a second of false does not mean the operation failed – this function always modifies the object.
Exceptions
kind_errorif the kind is not an object.

An insertion invalidates iterators and references as insert does; an assignment invalidates none.

See also
insert
try_emplace

◆ insert_or_assign() [2/2]

std::pair< object_iterator, bool > jsonv::value::insert_or_assign ( const std::wstring &  key,
value  val 
)

Insert val with the given key into this object if no element with an equivalent key is present; otherwise, assign val to the existing element.

Unlike try_emplace, val is stored either way.

Returns
A pair whose first refers to the inserted or assigned element and whose second is true if an insertion took place and false if an assignment took place. Unlike insert, a second of false does not mean the operation failed – this function always modifies the object.
Exceptions
kind_errorif the kind is not an object.

An insertion invalidates iterators and references as insert does; an assignment invalidates none.

See also
insert
try_emplace

◆ kind()

jsonv::kind jsonv::value::kind ( ) const
inline

Get this value's kind.

Definition at line 754 of file value.hpp.

◆ operator!=()

bool jsonv::value::operator!= ( const value &  other) const

Compares two JSON values for inequality.

The rules for inequality are the exact opposite of equality.

◆ operator=() [1/2]

value & jsonv::value::operator= ( const value &  source)

Copy-assigns source to this.

If an exception is thrown during the copy, it is propagated out. This instance will remain unchanged.

◆ operator=() [2/2]

value & jsonv::value::operator= ( value &&  source)
noexcept

Move-assigns source to this, leaving source as a null value.

Unlike a copy, this will never throw.

◆ operator==()

bool jsonv::value::operator== ( const value &  other) const

Compares two JSON values for equality.

Two JSON values are equal if and only if all of the following conditions apply:

  1. They have the same valid value for kind, where kind::integer and kind::decimal count as the same.
    • If kind is invalid (memory corruption), then two JSON values are not equal, even if they have been corrupted in the same way and even if they share this (a corrupt object is not equal to itself).
  2. The kind comparison is also equal:
    • Two null values are always equivalent.
    • string, integer and boolean follow the classic rules for their type.
    • decimals compare exactly, with signed zeros equal and all NaNs equal (see compare).
    • an integer and a decimal are equal only when the decimal holds exactly that integer (see compare).
    • objects are equal if they have the same keys and values corresponding with the same key are also equal.
    • arrays are equal if they have the same length and the values at each index are also equal.
Note
The rules for equality are based on Python dict and list.

◆ operator[]() [1/7]

value & jsonv::value::operator[] ( const std::string &  key)

Get the value associated with the given key of this object.

If the key does not exist, it will be created. Creating it invalidates iterators and references as insert does.

Exceptions
kind_errorif the kind is not an object.

◆ operator[]() [2/7]

value & jsonv::value::operator[] ( const std::wstring &  key)

Get the value associated with the given key of this object.

If the key does not exist, it will be created. Creating it invalidates iterators and references as insert does.

Exceptions
kind_errorif the kind is not an object.

◆ operator[]() [3/7]

value & jsonv::value::operator[] ( int  idx)
inline

Get the value in this array at the given idx.

The overloads which accept an int are required to resolve the type ambiguity of the literal 0 between a size_type and a char*.

Exceptions
kind_errorif the kind is not an array.

Definition at line 936 of file value.hpp.

+ Here is the call graph for this function:

◆ operator[]() [4/7]

const value & jsonv::value::operator[] ( int  idx) const
inline

Get the value in this array at the given idx.

The overloads which accept an int are required to resolve the type ambiguity of the literal 0 between a size_type and a char*.

Exceptions
kind_errorif the kind is not an array.

Definition at line 938 of file value.hpp.

+ Here is the call graph for this function:

◆ operator[]() [5/7]

value & jsonv::value::operator[] ( size_type  idx)

Get the value in this array at the given idx.

The overloads which accept an int are required to resolve the type ambiguity of the literal 0 between a size_type and a char*.

Exceptions
kind_errorif the kind is not an array.

◆ operator[]() [6/7]

const value & jsonv::value::operator[] ( size_type  idx) const

Get the value in this array at the given idx.

The overloads which accept an int are required to resolve the type ambiguity of the literal 0 between a size_type and a char*.

Exceptions
kind_errorif the kind is not an array.

◆ operator[]() [7/7]

value & jsonv::value::operator[] ( std::string &&  key)

Get the value associated with the given key of this object.

If the key does not exist, it will be created. Creating it invalidates iterators and references as insert does.

Exceptions
kind_errorif the kind is not an object.

◆ path() [1/3]

value & jsonv::value::path ( const path &  p)

Get or create the value specified by the path p.

This is the moral equivalent to operator[] for paths. If no value exists at the path, a new one is created as the default (null) value. If any path along the way either does not exist or is null, it is created for you, based on the implications of the specification p. Unlike at_path, which will throw if accessing a non-existent key of an object or going past the end of an array, this will simply create that path and fill in the blanks with null values.

Exceptions
kind_errorif the path traversal is not valid for the value (for example: if the path specifies an array index when the value is a string).
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).
std::length_errorif the path has an array index which no array can hold, such as the largest std::size_t.
std::bad_allocif there is not enough memory to create what the path needs.

If this throws, for any reason, *this is left as it was. What the path needs is built apart from the tree and added to it in a single step at the end, so there is no partial result: a null does not become [] and a key on the way to the failing index is not created. A path which already exists is only followed, with nothing allocated.

See also
at_path

◆ path() [2/3]

value & jsonv::value::path ( size_type  p)

Get or create the value specified by the path p.

This is the moral equivalent to operator[] for paths. If no value exists at the path, a new one is created as the default (null) value. If any path along the way either does not exist or is null, it is created for you, based on the implications of the specification p. Unlike at_path, which will throw if accessing a non-existent key of an object or going past the end of an array, this will simply create that path and fill in the blanks with null values.

Exceptions
kind_errorif the path traversal is not valid for the value (for example: if the path specifies an array index when the value is a string).
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).
std::length_errorif the path has an array index which no array can hold, such as the largest std::size_t.
std::bad_allocif there is not enough memory to create what the path needs.

If this throws, for any reason, *this is left as it was. What the path needs is built apart from the tree and added to it in a single step at the end, so there is no partial result: a null does not become [] and a key on the way to the failing index is not created. A path which already exists is only followed, with nothing allocated.

See also
at_path

◆ path() [3/3]

value & jsonv::value::path ( std::string_view  p)

Get or create the value specified by the path p.

This is the moral equivalent to operator[] for paths. If no value exists at the path, a new one is created as the default (null) value. If any path along the way either does not exist or is null, it is created for you, based on the implications of the specification p. Unlike at_path, which will throw if accessing a non-existent key of an object or going past the end of an array, this will simply create that path and fill in the blanks with null values.

Exceptions
kind_errorif the path traversal is not valid for the value (for example: if the path specifies an array index when the value is a string).
std::invalid_argumentif a std::string_view was specified that did not have a valid specification (see path::create).
std::length_errorif the path has an array index which no array can hold, such as the largest std::size_t.
std::bad_allocif there is not enough memory to create what the path needs.

If this throws, for any reason, *this is left as it was. What the path needs is built apart from the tree and added to it in a single step at the end, so there is no partial result: a null does not become [] and a key on the way to the failing index is not created. A path which already exists is only followed, with nothing allocated.

See also
at_path

◆ pop_back()

void jsonv::value::pop_back ( )

Pop an item off the back of this array.

Exceptions
kind_errorif the kind is not an array.
std::logic_errorif the array is empty.

◆ push_back() [1/2]

void jsonv::value::push_back ( const value &  item)

Push item to the back of this array.

Exceptions
kind_errorif the kind is not an array.

◆ push_back() [2/2]

void jsonv::value::push_back ( value &&  item)

Push item to the back of this array.

Exceptions
kind_errorif the kind is not an array.

◆ reserve()

void jsonv::value::reserve ( size_type  count)

Reserve at least count elements in the array.

Exceptions
kind_errorif the kind is not an array.

◆ resize()

void jsonv::value::resize ( size_type  count,
const value &  val = value() 
)

Resize the length of this array to count items.

If the resize creates new elements, fill those newly-created elements with val.

Exceptions
kind_errorif the kind is not an array.

◆ size()

size_type jsonv::value::size ( ) const

Get the number of items in this value.

  • object: The number of key/value pairs.
  • array: The number of values.
  • string: The number of code points in the string (including \0 values and counting multi-byte encodings as more than one value).
Exceptions
kind_errorif the kind is not an object, array or string.

◆ try_emplace() [1/2]

std::pair< object_iterator, bool > jsonv::value::try_emplace ( const std::string &  key,
value  val 
)

Insert val with the given key into this object, but only if no element with an equivalent key is already present.

Unlike emplace, key is not copied when the key is already present.

Note
val is taken by value, so a caller who passes std::move(x) has moved from x by the time this function is entered whether or not the insertion happens. It is the key which is spared, not val.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Returns
A pair whose first refers to the newly-inserted element (or the element which shares the key) and whose second is true if the insertion took place.
Exceptions
kind_errorif the kind is not an object.
See also
insert
insert_or_assign

◆ try_emplace() [2/2]

std::pair< object_iterator, bool > jsonv::value::try_emplace ( const std::wstring &  key,
value  val 
)

Insert val with the given key into this object, but only if no element with an equivalent key is already present.

Unlike emplace, key is not copied when the key is already present.

Note
val is taken by value, so a caller who passes std::move(x) has moved from x by the time this function is entered whether or not the insertion happens. It is the key which is spared, not val.

Inserting invalidates every iterator and reference to a member at or after the position inserted at, and every one of them if the object has to grow.

Returns
A pair whose first refers to the newly-inserted element (or the element which shares the key) and whose second is true if the insertion took place.
Exceptions
kind_errorif the kind is not an object.
See also
insert
insert_or_assign

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  stream,
const value &  val 
)
friend

Output this value to a stream, through an ostream_encoder.

The stream's format flags, width, fill and locale do not change the text written.


The documentation for this class was generated from the following file: