object.hpp 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707
  1. //
  2. // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/json
  8. //
  9. #ifndef BOOST_JSON_OBJECT_HPP
  10. #define BOOST_JSON_OBJECT_HPP
  11. #include <boost/json/detail/config.hpp>
  12. #include <boost/json/detail/object.hpp>
  13. #include <boost/json/detail/value.hpp>
  14. #include <boost/json/kind.hpp>
  15. #include <boost/json/pilfer.hpp>
  16. #include <boost/system/result.hpp>
  17. #include <boost/json/storage_ptr.hpp>
  18. #include <boost/json/string_view.hpp>
  19. #include <cstdlib>
  20. #include <initializer_list>
  21. #include <iterator>
  22. #include <type_traits>
  23. #include <utility>
  24. namespace boost {
  25. namespace json {
  26. class value;
  27. class value_ref;
  28. class key_value_pair;
  29. /** A dynamically sized associative container of JSON key/value pairs.
  30. This is an associative container whose elements
  31. are key/value pairs with unique keys.
  32. \n
  33. The elements are stored contiguously; iterators are
  34. ordinary pointers, allowing random access pointer
  35. arithmetic for retrieving elements.
  36. In addition, the container maintains an internal
  37. index to speed up find operations, reducing the
  38. average complexity for most lookups and insertions.
  39. \n
  40. Reallocations are usually costly operations in terms of
  41. performance, as elements are copied and the internal
  42. index must be rebuilt. The @ref reserve function can
  43. be used to eliminate reallocations if the number of
  44. elements is known beforehand.
  45. @par Allocators
  46. All elements stored in the container, and their
  47. children if any, will use the same memory resource that
  48. was used to construct the container.
  49. @par Thread Safety
  50. Non-const member functions may not be called
  51. concurrently with any other member functions.
  52. @par Satisfies
  53. <a href="https://en.cppreference.com/w/cpp/named_req/ContiguousContainer"><em>ContiguousContainer</em></a>,
  54. <a href="https://en.cppreference.com/w/cpp/named_req/ReversibleContainer"><em>ReversibleContainer</em></a>, and
  55. <a href="https://en.cppreference.com/w/cpp/named_req/SequenceContainer"><em>SequenceContainer</em></a>.
  56. */
  57. class object
  58. {
  59. struct table;
  60. class revert_construct;
  61. class revert_insert;
  62. friend class value;
  63. friend class object_test;
  64. using access = detail::access;
  65. using index_t = std::uint32_t;
  66. static index_t constexpr null_index_ =
  67. std::uint32_t(-1);
  68. storage_ptr sp_; // must come first
  69. kind k_ = kind::object; // must come second
  70. table* t_;
  71. BOOST_JSON_DECL
  72. static table empty_;
  73. template<class T>
  74. using is_inputit = typename std::enable_if<
  75. std::is_constructible<key_value_pair,
  76. typename std::iterator_traits<T>::reference
  77. >::value>::type;
  78. BOOST_JSON_DECL
  79. explicit
  80. object(detail::unchecked_object&& uo);
  81. public:
  82. /// Associated [Allocator](https://en.cppreference.com/w/cpp/named_req/Allocator)
  83. using allocator_type = container::pmr::polymorphic_allocator<value>;
  84. /** The type of keys.
  85. The function @ref string::max_size returns the
  86. maximum allowed size of strings used as keys.
  87. */
  88. using key_type = string_view;
  89. /// The type of mapped values
  90. using mapped_type = value;
  91. /// The element type
  92. using value_type = key_value_pair;
  93. /// The type used to represent unsigned integers
  94. using size_type = std::size_t;
  95. /// The type used to represent signed integers
  96. using difference_type = std::ptrdiff_t;
  97. /// A reference to an element
  98. using reference = value_type&;
  99. /// A const reference to an element
  100. using const_reference = value_type const&;
  101. /// A pointer to an element
  102. using pointer = value_type*;
  103. /// A const pointer to an element
  104. using const_pointer = value_type const*;
  105. /// A random access iterator to an element
  106. using iterator = value_type*;
  107. /// A const random access iterator to an element
  108. using const_iterator = value_type const*;
  109. /// A reverse random access iterator to an element
  110. using reverse_iterator =
  111. std::reverse_iterator<iterator>;
  112. /// A const reverse random access iterator to an element
  113. using const_reverse_iterator =
  114. std::reverse_iterator<const_iterator>;
  115. //------------------------------------------------------
  116. /** Destructor.
  117. The destructor for each element is called if needed, any used memory is
  118. deallocated, and shared ownership of the
  119. `boost::container::pmr::memory_resource` is released.
  120. @par Complexity
  121. Constant, or linear in @ref size().
  122. @par Exception Safety
  123. No-throw guarantee.
  124. */
  125. BOOST_JSON_DECL
  126. ~object() noexcept;
  127. //------------------------------------------------------
  128. /** Default constructor.
  129. The constructed object is empty with zero
  130. capacity, using the [default memory resource].
  131. @par Complexity
  132. Constant.
  133. @par Exception Safety
  134. No-throw guarantee.
  135. [default memory resource]: json/allocators/storage_ptr.html#json.allocators.storage_ptr.default_memory_resource
  136. */
  137. object() noexcept
  138. : t_(&empty_)
  139. {
  140. }
  141. /** Constructor.
  142. The constructed object is empty with zero
  143. capacity, using the specified memory resource.
  144. @par Complexity
  145. Constant.
  146. @par Exception Safety
  147. No-throw guarantee.
  148. @param sp A pointer to the `boost::container::pmr::memory_resource` to
  149. use. The container will acquire shared ownership of the memory
  150. resource.
  151. */
  152. explicit
  153. object(storage_ptr sp) noexcept
  154. : sp_(std::move(sp))
  155. , t_(&empty_)
  156. {
  157. }
  158. /** Constructor.
  159. The constructed object is empty with capacity
  160. equal to the specified minimum capacity,
  161. using the specified memory resource.
  162. @par Complexity
  163. Constant.
  164. @par Exception Safety
  165. Strong guarantee.
  166. Calls to `memory_resource::allocate` may throw.
  167. @param min_capacity The minimum number
  168. of elements for which capacity is guaranteed
  169. without a subsequent reallocation.
  170. @param sp A pointer to the `boost::container::pmr::memory_resource` to
  171. use. The container will acquire shared ownership of the memory
  172. resource.
  173. */
  174. BOOST_JSON_DECL
  175. object(
  176. std::size_t min_capacity,
  177. storage_ptr sp = {});
  178. /** Constructor.
  179. The object is constructed with the elements
  180. in the range `{first, last)`, preserving order,
  181. using the specified memory resource.
  182. If there are elements with duplicate keys; that
  183. is, if multiple elements in the range have keys
  184. that compare equal, only the first equivalent
  185. element will be inserted.
  186. @par Constraints
  187. @code
  188. std::is_constructible_v<
  189. key_value_pair,
  190. std::iterator_traits<InputIt>::reference>
  191. @endcode
  192. @par Complexity
  193. Linear in `std::distance(first, last)`.
  194. @par Exception Safety
  195. Strong guarantee.
  196. Calls to `memory_resource::allocate` may throw.
  197. @param first An input iterator pointing to the
  198. first element to insert, or pointing to the end
  199. of the range.
  200. @param last An input iterator pointing to the end
  201. of the range.
  202. @param min_capacity The minimum number
  203. of elements for which capacity is guaranteed
  204. without a subsequent reallocation.
  205. Upon construction, @ref capacity() will be greater
  206. than or equal to this number.
  207. @param sp A pointer to the `boost::container::pmr::memory_resource` to
  208. use. The container will acquire shared ownership of the memory
  209. resource.
  210. @tparam InputIt a type satisfying the requirements
  211. of __InputIterator__.
  212. */
  213. template<
  214. class InputIt
  215. #ifndef BOOST_JSON_DOCS
  216. ,class = is_inputit<InputIt>
  217. #endif
  218. >
  219. object(
  220. InputIt first,
  221. InputIt last,
  222. std::size_t min_capacity = 0,
  223. storage_ptr sp = {})
  224. : sp_(std::move(sp))
  225. , t_(&empty_)
  226. {
  227. construct(
  228. first, last,
  229. min_capacity,
  230. typename std::iterator_traits<
  231. InputIt>::iterator_category{});
  232. }
  233. /** Move constructor.
  234. The object is constructed by acquiring ownership of
  235. the contents of `other` and shared ownership
  236. of `other`'s memory resource.
  237. @note
  238. After construction, the moved-from object behaves
  239. as if newly constructed with its current memory resource.
  240. @par Complexity
  241. Constant.
  242. @par Exception Safety
  243. No-throw guarantee.
  244. @param other The object to move.
  245. */
  246. BOOST_JSON_DECL
  247. object(object&& other) noexcept;
  248. /** Move constructor.
  249. The object is constructed with the contents of
  250. `other` by move semantics, using the specified
  251. memory resource:
  252. @li If `*other.storage() == *sp`, ownership of
  253. the underlying memory is transferred in constant
  254. time, with no possibility of exceptions.
  255. After construction, the moved-from object behaves
  256. as if newly constructed with its current storage
  257. pointer.
  258. @li If `*other.storage() != *sp`, an
  259. element-wise copy is performed, which may throw.
  260. In this case, the moved-from object is not
  261. changed.
  262. @par Complexity
  263. Constant or linear in `other.size()`.
  264. @par Exception Safety
  265. Strong guarantee.
  266. Calls to `memory_resource::allocate` may throw.
  267. @param other The object to move.
  268. @param sp A pointer to the `boost::container::pmr::memory_resource` to
  269. use. The container will acquire shared ownership of the memory
  270. resource.
  271. */
  272. BOOST_JSON_DECL
  273. object(
  274. object&& other,
  275. storage_ptr sp);
  276. /** Pilfer constructor.
  277. The object is constructed by acquiring ownership
  278. of the contents of `other` using pilfer semantics.
  279. This is more efficient than move construction, when
  280. it is known that the moved-from object will be
  281. immediately destroyed afterwards.
  282. @par Complexity
  283. Constant.
  284. @par Exception Safety
  285. No-throw guarantee.
  286. @param other The value to pilfer. After pilfer
  287. construction, `other` is not in a usable state
  288. and may only be destroyed.
  289. @see @ref pilfer,
  290. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0308r0.html">
  291. Valueless Variants Considered Harmful</a>
  292. */
  293. object(pilfered<object> other) noexcept
  294. : sp_(std::move(other.get().sp_))
  295. , t_(detail::exchange(
  296. other.get().t_, &empty_))
  297. {
  298. }
  299. /** Copy constructor.
  300. The object is constructed with a copy of the
  301. contents of `other`, using `other`'s memory resource.
  302. @par Complexity
  303. Linear in `other.size()`.
  304. @par Exception Safety
  305. Strong guarantee.
  306. Calls to `memory_resource::allocate` may throw.
  307. @param other The object to copy.
  308. */
  309. object(
  310. object const& other)
  311. : object(other, other.sp_)
  312. {
  313. }
  314. /** Copy constructor.
  315. The object is constructed with a copy of the
  316. contents of `other`, using the specified memory resource.
  317. @par Complexity
  318. Linear in `other.size()`.
  319. @par Exception Safety
  320. Strong guarantee.
  321. Calls to `memory_resource::allocate` may throw.
  322. @param other The object to copy.
  323. @param sp A pointer to the `boost::container::pmr::memory_resource` to
  324. use. The container will acquire shared ownership of the memory
  325. resource.
  326. */
  327. BOOST_JSON_DECL
  328. object(
  329. object const& other,
  330. storage_ptr sp);
  331. /** Construct from initializer-list.
  332. The object is constructed with a copy of the values
  333. in the initializer-list in order, using the
  334. specified memory resource.
  335. If there are elements with duplicate keys; that
  336. is, if multiple elements in the range have keys
  337. that compare equal, only the first equivalent
  338. element will be inserted.
  339. @par Complexity
  340. Linear in `init.size()`.
  341. @par Exception Safety
  342. Strong guarantee.
  343. Calls to `memory_resource::allocate` may throw.
  344. @param init The initializer list to insert.
  345. @param sp A pointer to the `boost::container::pmr::memory_resource` to
  346. use. The container will acquire shared ownership of the memory
  347. resource.
  348. */
  349. object(
  350. std::initializer_list<
  351. std::pair<string_view, value_ref>> init,
  352. storage_ptr sp = {})
  353. : object(init, 0, std::move(sp))
  354. {
  355. }
  356. /** Construct from initializer-list.
  357. Storage for at least `min_capacity` elements is
  358. reserved, and then
  359. the object is constructed with a copy of the values
  360. in the initializer-list in order, using the
  361. specified memory resource.
  362. If there are elements with duplicate keys; that
  363. is, if multiple elements in the range have keys
  364. that compare equal, only the first equivalent
  365. element will be inserted.
  366. @par Complexity
  367. Linear in `init.size()`.
  368. @par Exception Safety
  369. Strong guarantee.
  370. Calls to `memory_resource::allocate` may throw.
  371. @param init The initializer list to insert.
  372. @param min_capacity The minimum number
  373. of elements for which capacity is guaranteed
  374. without a subsequent reallocation.
  375. Upon construction, @ref capacity() will be greater
  376. than or equal to this number.
  377. @param sp A pointer to the `boost::container::pmr::memory_resource` to
  378. use. The container will acquire shared ownership of the memory
  379. resource.
  380. */
  381. BOOST_JSON_DECL
  382. object(
  383. std::initializer_list<
  384. std::pair<string_view, value_ref>> init,
  385. std::size_t min_capacity,
  386. storage_ptr sp = {});
  387. //------------------------------------------------------
  388. //
  389. // Assignment
  390. //
  391. //------------------------------------------------------
  392. /** Copy assignment.
  393. The contents of the object are replaced with an
  394. element-wise copy of `other`.
  395. @par Complexity
  396. Linear in @ref size() plus `other.size()`.
  397. @par Exception Safety
  398. Strong guarantee.
  399. Calls to `memory_resource::allocate` may throw.
  400. @param other The object to copy.
  401. */
  402. BOOST_JSON_DECL
  403. object&
  404. operator=(object const& other);
  405. /** Move assignment.
  406. The contents of the object are replaced with the
  407. contents of `other` using move semantics:
  408. @li If `*other.storage() == *sp`, ownership of
  409. the underlying memory is transferred in constant
  410. time, with no possibility of exceptions.
  411. After assignment, the moved-from object behaves
  412. as if newly constructed with its current storage
  413. pointer.
  414. @li If `*other.storage() != *sp`, an
  415. element-wise copy is performed, which may throw.
  416. In this case, the moved-from object is not
  417. changed.
  418. @par Complexity
  419. Constant or linear in @ref size() plus `other.size()`.
  420. @par Exception Safety
  421. Strong guarantee.
  422. Calls to `memory_resource::allocate` may throw.
  423. @param other The object to move.
  424. */
  425. BOOST_JSON_DECL
  426. object&
  427. operator=(object&& other);
  428. /** Assignment.
  429. Replaces the contents with the contents of an
  430. initializer list.
  431. @par Complexity
  432. Linear in @ref size() plus
  433. average case linear in `init.size()`,
  434. worst case quadratic in `init.size()`.
  435. @par Exception Safety
  436. Strong guarantee.
  437. Calls to `memory_resource::allocate` may throw.
  438. @param init The initializer list to copy.
  439. */
  440. BOOST_JSON_DECL
  441. object&
  442. operator=(std::initializer_list<
  443. std::pair<string_view, value_ref>> init);
  444. //------------------------------------------------------
  445. /** Return the associated memory resource.
  446. This function returns the `boost::container::pmr::memory_resource` used
  447. by the container.
  448. @par Complexity
  449. Constant.
  450. @par Exception Safety
  451. No-throw guarantee.
  452. */
  453. storage_ptr const&
  454. storage() const noexcept
  455. {
  456. return sp_;
  457. }
  458. /** Return the associated allocator.
  459. This function returns an instance of @ref allocator_type constructed
  460. from the associated `boost::container::pmr::memory_resource`.
  461. @par Complexity
  462. Constant.
  463. @par Exception Safety
  464. No-throw guarantee.
  465. */
  466. allocator_type
  467. get_allocator() const noexcept
  468. {
  469. return sp_.get();
  470. }
  471. //------------------------------------------------------
  472. //
  473. // Iterators
  474. //
  475. //------------------------------------------------------
  476. /** Return an iterator to the first element.
  477. If the container is empty, @ref end() is returned.
  478. @par Complexity
  479. Constant.
  480. @par Exception Safety
  481. No-throw guarantee.
  482. */
  483. inline
  484. iterator
  485. begin() noexcept;
  486. /** Return a const iterator to the first element.
  487. If the container is empty, @ref end() is returned.
  488. @par Complexity
  489. Constant.
  490. @par Exception Safety
  491. No-throw guarantee.
  492. */
  493. inline
  494. const_iterator
  495. begin() const noexcept;
  496. /** Return a const iterator to the first element.
  497. If the container is empty, @ref cend() is returned.
  498. @par Complexity
  499. Constant.
  500. @par Exception Safety
  501. No-throw guarantee.
  502. */
  503. inline
  504. const_iterator
  505. cbegin() const noexcept;
  506. /** Return an iterator to the element following the last element.
  507. The element acts as a placeholder; attempting
  508. to access it results in undefined behavior.
  509. @par Complexity
  510. Constant.
  511. @par Exception Safety
  512. No-throw guarantee.
  513. */
  514. inline
  515. iterator
  516. end() noexcept;
  517. /** Return a const iterator to the element following the last element.
  518. The element acts as a placeholder; attempting
  519. to access it results in undefined behavior.
  520. @par Complexity
  521. Constant.
  522. @par Exception Safety
  523. No-throw guarantee.
  524. */
  525. inline
  526. const_iterator
  527. end() const noexcept;
  528. /** Return a const iterator to the element following the last element.
  529. The element acts as a placeholder; attempting
  530. to access it results in undefined behavior.
  531. @par Complexity
  532. Constant.
  533. @par Exception Safety
  534. No-throw guarantee.
  535. */
  536. inline
  537. const_iterator
  538. cend() const noexcept;
  539. /** Return a reverse iterator to the first element of the reversed container.
  540. The pointed-to element corresponds to the
  541. last element of the non-reversed container.
  542. If the container is empty, @ref rend() is returned.
  543. @par Complexity
  544. Constant.
  545. @par Exception Safety
  546. No-throw guarantee.
  547. */
  548. inline
  549. reverse_iterator
  550. rbegin() noexcept;
  551. /** Return a const reverse iterator to the first element of the reversed container.
  552. The pointed-to element corresponds to the
  553. last element of the non-reversed container.
  554. If the container is empty, @ref rend() is returned.
  555. @par Complexity
  556. Constant.
  557. @par Exception Safety
  558. No-throw guarantee.
  559. */
  560. inline
  561. const_reverse_iterator
  562. rbegin() const noexcept;
  563. /** Return a const reverse iterator to the first element of the reversed container.
  564. The pointed-to element corresponds to the
  565. last element of the non-reversed container.
  566. If the container is empty, @ref crend() is returned.
  567. @par Complexity
  568. Constant.
  569. @par Exception Safety
  570. No-throw guarantee.
  571. */
  572. inline
  573. const_reverse_iterator
  574. crbegin() const noexcept;
  575. /** Return a reverse iterator to the element following the last element of the reversed container.
  576. The pointed-to element corresponds to the element
  577. preceding the first element of the non-reversed container.
  578. This element acts as a placeholder, attempting
  579. to access it results in undefined behavior.
  580. @par Complexity
  581. Constant.
  582. @par Exception Safety
  583. No-throw guarantee.
  584. */
  585. inline
  586. reverse_iterator
  587. rend() noexcept;
  588. /** Return a const reverse iterator to the element following the last element of the reversed container.
  589. The pointed-to element corresponds to the element
  590. preceding the first element of the non-reversed container.
  591. This element acts as a placeholder, attempting
  592. to access it results in undefined behavior.
  593. @par Complexity
  594. Constant.
  595. @par Exception Safety
  596. No-throw guarantee.
  597. */
  598. inline
  599. const_reverse_iterator
  600. rend() const noexcept;
  601. /** Return a const reverse iterator to the element following the last element of the reversed container.
  602. The pointed-to element corresponds to the element
  603. preceding the first element of the non-reversed container.
  604. This element acts as a placeholder, attempting
  605. to access it results in undefined behavior.
  606. @par Complexity
  607. Constant.
  608. @par Exception Safety
  609. No-throw guarantee.
  610. */
  611. inline
  612. const_reverse_iterator
  613. crend() const noexcept;
  614. //------------------------------------------------------
  615. //
  616. // Capacity
  617. //
  618. //------------------------------------------------------
  619. /** Return whether there are no elements.
  620. Returns `true` if there are no elements in
  621. the container, i.e. @ref size() returns 0.
  622. @par Complexity
  623. Constant.
  624. @par Exception Safety
  625. No-throw guarantee.
  626. */
  627. inline
  628. bool
  629. empty() const noexcept;
  630. /** Return the number of elements.
  631. This returns the number of elements in the container.
  632. @par Complexity
  633. Constant.
  634. @par Exception Safety
  635. No-throw guarantee.
  636. */
  637. inline
  638. std::size_t
  639. size() const noexcept;
  640. /** Return the maximum number of elements any object can hold
  641. The maximum is an implementation-defined number dependent
  642. on system or library implementation. This value is a
  643. theoretical limit; at runtime, the actual maximum size
  644. may be less due to resource limits.
  645. @par Complexity
  646. Constant.
  647. @par Exception Safety
  648. No-throw guarantee.
  649. */
  650. static
  651. constexpr
  652. std::size_t
  653. max_size() noexcept;
  654. /** Return the number of elements that can be held in currently allocated memory
  655. This number may be larger than the value returned
  656. by @ref size().
  657. @par Complexity
  658. Constant.
  659. @par Exception Safety
  660. No-throw guarantee.
  661. */
  662. inline
  663. std::size_t
  664. capacity() const noexcept;
  665. /** Increase the capacity to at least a certain amount.
  666. This increases the @ref capacity() to a value
  667. that is greater than or equal to `new_capacity`.
  668. If `new_capacity > capacity()`, new memory is
  669. allocated. Otherwise, the call has no effect.
  670. The number of elements and therefore the
  671. @ref size() of the container is not changed.
  672. \n
  673. If new memory is allocated, all iterators
  674. including any past-the-end iterators, and all
  675. references to the elements are invalidated.
  676. Otherwise, no iterators or references are
  677. invalidated.
  678. @par Complexity
  679. Constant or average case linear in
  680. @ref size(), worst case quadratic.
  681. @par Exception Safety
  682. Strong guarantee.
  683. Calls to `memory_resource::allocate` may throw.
  684. @param new_capacity The new minimum capacity.
  685. @throw `boost::system::system_error` `new_capacity > max_size()`.
  686. */
  687. inline
  688. void
  689. reserve(std::size_t new_capacity);
  690. //------------------------------------------------------
  691. //
  692. // Modifiers
  693. //
  694. //------------------------------------------------------
  695. /** Erase all elements.
  696. Erases all elements from the container without
  697. changing the capacity.
  698. After this call, @ref size() returns zero.
  699. All references, pointers, and iterators are
  700. invalidated.
  701. @par Complexity
  702. Linear in @ref size().
  703. @par Exception Safety
  704. No-throw guarantee.
  705. */
  706. BOOST_JSON_DECL
  707. void
  708. clear() noexcept;
  709. /** Insert elements.
  710. Inserts `p` if `this->contains(value_type(p).key())` is `false`.
  711. @ref value_type must be constructible from `p`.
  712. If the insertion occurs and results in a rehashing
  713. of the container, all iterators and references are invalidated.
  714. Otherwise, they are not affected.
  715. Rehashing occurs only if the new number of elements
  716. is greater than @ref capacity().
  717. @par Constraints
  718. @code
  719. std::is_constructible_v<value_type, P>
  720. @endcode
  721. @par Complexity
  722. Average case amortized constant,
  723. worst case linear in @ref size().
  724. @par Exception Safety
  725. Strong guarantee.
  726. Calls to `memory_resource::allocate` may throw.
  727. @param p The value to insert.
  728. @throw `boost::system::system_error` key is too long.
  729. @throw `boost::system::system_error` @ref size() >= max_size().
  730. @return A pair where `first` is an iterator
  731. to the existing or inserted element, and `second`
  732. is `true` if the insertion took place or `false` otherwise.
  733. */
  734. template<class P
  735. #ifndef BOOST_JSON_DOCS
  736. ,class = typename std::enable_if<
  737. std::is_constructible<key_value_pair,
  738. P, storage_ptr>::value>::type
  739. #endif
  740. >
  741. std::pair<iterator, bool>
  742. insert(P&& p);
  743. /** Insert elements.
  744. The elements in the range `[first, last)` are inserted one at a time,
  745. in order. Any element with key that is a duplicate of a key already
  746. present in container will be skipped. This also means, that if there
  747. are two keys within the range that are equal to each other, only the
  748. first will be inserted.
  749. Insertion may result in rehashing of the container. In that case all
  750. iterators and references are invalidated. Otherwise, they are not
  751. affected.
  752. @par Precondition
  753. `first` and `last` are not iterators into `*this`.
  754. `first` and `last` form a valid range.
  755. @par Constraints
  756. @code
  757. std::is_constructible_v<value_type, std::iterator_traits<InputIt>::reference>
  758. @endcode
  759. @par Complexity
  760. Linear in `std::distance(first, last)`.
  761. @par Exception Safety
  762. Strong guarantee for forward iterators, basic guarantee for input
  763. iterators.
  764. Calls to `memory_resource::allocate` may throw.
  765. @param first An input iterator pointing to the first
  766. element to insert, or pointing to the end of the range.
  767. @param last An input iterator pointing to the end
  768. of the range.
  769. @tparam InputIt a type satisfying the requirements
  770. of __InputIterator__.
  771. */
  772. template<
  773. class InputIt
  774. #ifndef BOOST_JSON_DOCS
  775. ,class = is_inputit<InputIt>
  776. #endif
  777. >
  778. void
  779. insert(InputIt first, InputIt last)
  780. {
  781. insert(first, last, typename
  782. std::iterator_traits<InputIt
  783. >::iterator_category{});
  784. }
  785. /** Insert elements.
  786. The elements in the initializer list are inserted one at a time, in
  787. order. Any element with key that is a duplicate of a key already
  788. present in container will be skipped. This also means, that if there
  789. are two keys within the initializer list that are equal to each other,
  790. only the first will be inserted.
  791. Insertion may result in rehashing of the container. In that case all
  792. iterators and references are invalidated. Otherwise, they are not
  793. affected.
  794. @par Complexity
  795. Linear in `init.size()`.
  796. @par Exception Safety
  797. Basic guarantee.
  798. Calls to `memory_resource::allocate` may throw.
  799. @param init The initializer list to insert
  800. */
  801. BOOST_JSON_DECL
  802. void
  803. insert(std::initializer_list<
  804. std::pair<string_view, value_ref>> init);
  805. /** Insert an element or assign to the current element if the key already exists.
  806. If the key equivalent to `key` already exists in the
  807. container, assigns `std::forward<M>(m)` to the
  808. `mapped_type` corresponding to the key. Otherwise,
  809. inserts the new value at the end as if by insert,
  810. constructing it from `value_type(key, std::forward<M>(m))`.
  811. If the insertion occurs and results in a rehashing of the container,
  812. all iterators and references are invalidated. Otherwise, they are not
  813. affected. Rehashing occurs only if the new number of elements is
  814. greater than @ref capacity().
  815. @par Complexity
  816. Amortized constant on average, worst case linear in @ref size().
  817. @par Exception Safety
  818. Strong guarantee.
  819. Calls to `memory_resource::allocate` may throw.
  820. @return A `std::pair` where `first` is an iterator
  821. to the existing or inserted element, and `second`
  822. is `true` if the insertion took place or `false` if
  823. the assignment took place.
  824. @param key The key used for lookup and insertion
  825. @param m The value to insert or assign
  826. @throw `boost::system::system_error` if key is too long.
  827. */
  828. template<class M>
  829. std::pair<iterator, bool>
  830. insert_or_assign(
  831. string_view key, M&& m);
  832. /** Construct an element in-place.
  833. Inserts a new element into the container constructed
  834. in-place with the given argument if there is no
  835. element with the `key` in the container.
  836. If the insertion occurs and results in a rehashing of the container,
  837. all iterators and references are invalidated. Otherwise, they are not
  838. affected. Rehashing occurs only if the new number of elements is
  839. greater than @ref capacity().
  840. @par Complexity
  841. Amortized constant on average, worst case linear in @ref size().
  842. @par Exception Safety
  843. Strong guarantee.
  844. Calls to `memory_resource::allocate` may throw.
  845. @return A `std::pair` where `first` is an iterator
  846. to the existing or inserted element, and `second`
  847. is `true` if the insertion took place or `false` otherwise.
  848. @param key The key used for lookup and insertion
  849. @param arg The argument used to construct the value.
  850. This will be passed as `std::forward<Arg>(arg)` to
  851. the @ref value constructor.
  852. @throw `boost::system::system_error` if key is too long.
  853. */
  854. template<class Arg>
  855. std::pair<iterator, bool>
  856. emplace(string_view key, Arg&& arg);
  857. /** Erase an element
  858. Remove the element pointed to by `pos`, which must
  859. be valid and dereferenceable.
  860. References and iterators to the erased element are
  861. invalidated. Other iterators and references are not
  862. invalidated.
  863. @note
  864. The @ref end() iterator (which is valid but cannot be
  865. dereferenced) cannot be used as a value for `pos`.
  866. @par Complexity
  867. Constant on average, worst case linear in @ref size().
  868. @par Exception Safety
  869. No-throw guarantee.
  870. @return An iterator following the removed element.
  871. @param pos An iterator pointing to the element to be
  872. removed.
  873. */
  874. BOOST_JSON_DECL
  875. iterator
  876. erase(const_iterator pos) noexcept;
  877. /** Erase an element
  878. Remove the element which matches `key`, if it exists.
  879. References and iterators to the erased element are
  880. invalidated. Other iterators and references are not
  881. invalidated.
  882. @par Complexity
  883. Constant on average, worst case linear in @ref size().
  884. @par Exception Safety
  885. No-throw guarantee.
  886. @return The number of elements removed, which will
  887. be either 0 or 1.
  888. @param key The key to match.
  889. */
  890. BOOST_JSON_DECL
  891. std::size_t
  892. erase(string_view key) noexcept;
  893. /** Erase an element preserving order
  894. Remove the element pointed to by `pos`, which must be valid and
  895. dereferenceable. References and iterators from `pos` to @ref end(),
  896. both included, are invalidated. Other iterators and references are not
  897. invalidated. The relative order of remaining elements is preserved.
  898. @note
  899. The @ref end() iterator (which is valid but cannot be dereferenced)
  900. cannot be used as a value for `pos`.
  901. @par Complexity
  902. Linear in @ref size().
  903. @par Exception Safety
  904. No-throw guarantee.
  905. @return An iterator following the removed element.
  906. @param pos An iterator pointing to the element to be
  907. removed.
  908. */
  909. BOOST_JSON_DECL
  910. iterator
  911. stable_erase(const_iterator pos) noexcept;
  912. /** Erase an element preserving order
  913. Remove the element which matches `key`, if it exists.
  914. All references and iterators are invalidated.
  915. The relative order of remaining elements is preserved.
  916. @par Complexity
  917. Linear in @ref size().
  918. @par Exception Safety
  919. No-throw guarantee.
  920. @return The number of elements removed, which will
  921. be either 0 or 1.
  922. @param key The key to match.
  923. */
  924. BOOST_JSON_DECL
  925. std::size_t
  926. stable_erase(string_view key) noexcept;
  927. /** Swap two objects.
  928. Exchanges the contents of this object with another object. Ownership of
  929. the respective `boost::container::pmr::memory_resource` objects is not
  930. transferred.
  931. @li If `*other.storage() == *this->storage()`,
  932. ownership of the underlying memory is swapped in
  933. constant time, with no possibility of exceptions.
  934. All iterators and references remain valid.
  935. @li If `*other.storage() != *this->storage()`,
  936. the contents are logically swapped by making copies,
  937. which can throw. In this case all iterators and
  938. references are invalidated.
  939. @par Complexity
  940. Constant or linear in @ref size() plus `other.size()`.
  941. @par Exception Safety
  942. Strong guarantee.
  943. Calls to `memory_resource::allocate` may throw.
  944. @param other The object to swap with.
  945. If `this == &other`, this function call has no effect.
  946. */
  947. BOOST_JSON_DECL
  948. void
  949. swap(object& other);
  950. /** Swap two objects.
  951. Exchanges the contents of the object `lhs` with another object `rhs`.
  952. Ownership of the respective `boost::container::pmr::memory_resource`
  953. objects is not transferred.
  954. @li If `*lhs.storage() == *rhs.storage()`,
  955. ownership of the underlying memory is swapped in
  956. constant time, with no possibility of exceptions.
  957. All iterators and references remain valid.
  958. @li If `*lhs.storage() != *rhs.storage()`,
  959. the contents are logically swapped by making a copy,
  960. which can throw. In this case all iterators and
  961. references are invalidated.
  962. @par Effects
  963. @code
  964. lhs.swap( rhs );
  965. @endcode
  966. @par Complexity
  967. Constant or linear in `lhs.size() + rhs.size()`.
  968. @par Exception Safety
  969. Strong guarantee.
  970. Calls to `memory_resource::allocate` may throw.
  971. @param lhs The object to exchange.
  972. @param rhs The object to exchange.
  973. If `&lhs == &rhs`, this function call has no effect.
  974. @see @ref object::swap
  975. */
  976. friend
  977. void
  978. swap(object& lhs, object& rhs)
  979. {
  980. lhs.swap(rhs);
  981. }
  982. //------------------------------------------------------
  983. //
  984. // Lookup
  985. //
  986. //------------------------------------------------------
  987. /** Access the specified element, with bounds checking.
  988. Returns `boost::system::result` containing a reference to the
  989. mapped value of the element that matches `key`. Otherwise the result
  990. contains an `error_code`.
  991. @par Exception Safety
  992. No-throw guarantee.
  993. @param key The key of the element to find.
  994. @par Complexity
  995. Constant on average, worst case linear in @ref size().
  996. */
  997. /** @{ */
  998. BOOST_JSON_DECL
  999. system::result<value&>
  1000. try_at(string_view key) noexcept;
  1001. BOOST_JSON_DECL
  1002. system::result<value const&>
  1003. try_at(string_view key) const noexcept;
  1004. /** @} */
  1005. /** Access the specified element, with bounds checking.
  1006. Returns a reference to the mapped value of the element
  1007. that matches `key`, otherwise throws.
  1008. @par Complexity
  1009. Constant on average, worst case linear in @ref size().
  1010. @par Exception Safety
  1011. Strong guarantee.
  1012. @return A reference to the mapped value.
  1013. @param key The key of the element to find.
  1014. @param loc `source_location` to use in thrown exception; the source
  1015. location of the call site by default.
  1016. @throw `boost::system::system_error` if no such element exists.
  1017. */
  1018. /** @{ */
  1019. inline
  1020. value&
  1021. at(
  1022. string_view key,
  1023. source_location const& loc = BOOST_CURRENT_LOCATION) &;
  1024. inline
  1025. value&&
  1026. at(
  1027. string_view key,
  1028. source_location const& loc = BOOST_CURRENT_LOCATION) &&;
  1029. BOOST_JSON_DECL
  1030. value const&
  1031. at(
  1032. string_view key,
  1033. source_location const& loc = BOOST_CURRENT_LOCATION) const&;
  1034. /** @} */
  1035. /** Access or insert the specified element
  1036. Returns a reference to the value that is mapped
  1037. to a key equivalent to key, performing an insertion
  1038. of a null value if such key does not already exist.
  1039. \n
  1040. If an insertion occurs and results in a rehashing of
  1041. the container, all iterators are invalidated. Otherwise
  1042. iterators are not affected. References are not
  1043. invalidated. Rehashing occurs only if the new
  1044. number of elements is greater than @ref capacity().
  1045. @par Complexity
  1046. Constant on average, worst case linear in @ref size().
  1047. @par Exception Safety
  1048. Strong guarantee.
  1049. Calls to `memory_resource::allocate` may throw.
  1050. @return A reference to the mapped value.
  1051. @param key The key of the element to find.
  1052. */
  1053. BOOST_JSON_DECL
  1054. value&
  1055. operator[](string_view key);
  1056. /** Count the number of elements with a specific key
  1057. This function returns the count of the number of
  1058. elements match `key`. The only possible return values
  1059. are 0 and 1.
  1060. @par Complexity
  1061. Constant on average, worst case linear in @ref size().
  1062. @par Exception Safety
  1063. No-throw guarantee.
  1064. @param key The key of the element to find.
  1065. */
  1066. BOOST_JSON_DECL
  1067. std::size_t
  1068. count(string_view key) const noexcept;
  1069. /** Find an element with a specific key
  1070. This function returns an iterator to the element
  1071. matching `key` if it exists, otherwise returns
  1072. @ref end().
  1073. @par Complexity
  1074. Constant on average, worst case linear in @ref size().
  1075. @par Exception Safety
  1076. No-throw guarantee.
  1077. @param key The key of the element to find.
  1078. */
  1079. BOOST_JSON_DECL
  1080. iterator
  1081. find(string_view key) noexcept;
  1082. /** Find an element with a specific key
  1083. This function returns a constant iterator to
  1084. the element matching `key` if it exists,
  1085. otherwise returns @ref end().
  1086. @par Complexity
  1087. Constant on average, worst case linear in @ref size().
  1088. @par Exception Safety
  1089. No-throw guarantee.
  1090. @param key The key of the element to find.
  1091. */
  1092. BOOST_JSON_DECL
  1093. const_iterator
  1094. find(string_view key) const noexcept;
  1095. /** Return `true` if the key is found
  1096. This function returns `true` if a key with the
  1097. specified string is found.
  1098. @par Effects
  1099. @code
  1100. return this->find(key) != this->end();
  1101. @endcode
  1102. @par Complexity
  1103. Constant on average, worst case linear in @ref size().
  1104. @par Exception Safety
  1105. No-throw guarantee.
  1106. @param key The key of the element to find.
  1107. @see @ref find
  1108. */
  1109. BOOST_JSON_DECL
  1110. bool
  1111. contains(string_view key) const noexcept;
  1112. /** Return a pointer to the value if the key is found, or null
  1113. This function searches for a value with the given
  1114. key, and returns a pointer to it if found. Otherwise
  1115. it returns null.
  1116. @par Example
  1117. @code
  1118. if( auto p = obj.if_contains( "key" ) )
  1119. std::cout << *p;
  1120. @endcode
  1121. @par Complexity
  1122. Constant on average, worst case linear in @ref size().
  1123. @par Exception Safety
  1124. No-throw guarantee.
  1125. @param key The key of the element to find.
  1126. @see @ref find
  1127. */
  1128. BOOST_JSON_DECL
  1129. value const*
  1130. if_contains(string_view key) const noexcept;
  1131. /** Return a pointer to the value if the key is found, or null
  1132. This function searches for a value with the given
  1133. key, and returns a pointer to it if found. Otherwise
  1134. it returns null.
  1135. @par Example
  1136. @code
  1137. if( auto p = obj.if_contains( "key" ) )
  1138. std::cout << *p;
  1139. @endcode
  1140. @par Complexity
  1141. Constant on average, worst case linear in @ref size().
  1142. @par Exception Safety
  1143. No-throw guarantee.
  1144. @param key The key of the element to find.
  1145. @see @ref find
  1146. */
  1147. BOOST_JSON_DECL
  1148. value*
  1149. if_contains(string_view key) noexcept;
  1150. /** Return `true` if two objects are equal.
  1151. Objects are equal when their sizes are the same,
  1152. and when for each key in `lhs` there is a matching
  1153. key in `rhs` with the same value.
  1154. @par Complexity
  1155. Constant, or linear (worst case quadratic) in `lhs.size()`.
  1156. @par Exception Safety
  1157. No-throw guarantee.
  1158. */
  1159. // inline friend speeds up overload resolution
  1160. friend
  1161. bool
  1162. operator==(
  1163. object const& lhs,
  1164. object const& rhs) noexcept
  1165. {
  1166. return lhs.equal(rhs);
  1167. }
  1168. /** Return `true` if two objects are not equal.
  1169. Objects are equal when their sizes are the same,
  1170. and when for each key in `lhs` there is a matching
  1171. key in `rhs` with the same value.
  1172. @par Complexity
  1173. Constant, or linear (worst case quadratic) in `lhs.size()`.
  1174. @par Exception Safety
  1175. No-throw guarantee.
  1176. */
  1177. // inline friend speeds up overload resolution
  1178. friend
  1179. bool
  1180. operator!=(
  1181. object const& lhs,
  1182. object const& rhs) noexcept
  1183. {
  1184. return ! (lhs == rhs);
  1185. }
  1186. /** Serialize @ref object to an output stream.
  1187. This function serializes an `object` as JSON into the output stream.
  1188. @return Reference to `os`.
  1189. @par Complexity
  1190. Constant or linear in the size of `obj`.
  1191. @par Exception Safety
  1192. Strong guarantee.
  1193. Calls to `memory_resource::allocate` may throw.
  1194. @param os The output stream to serialize to.
  1195. @param obj The value to serialize.
  1196. */
  1197. BOOST_JSON_DECL
  1198. friend
  1199. std::ostream&
  1200. operator<<(
  1201. std::ostream& os,
  1202. object const& obj);
  1203. private:
  1204. #ifndef BOOST_JSON_DOCS
  1205. // VFALCO friending a detail function makes it public
  1206. template<class CharRange>
  1207. friend
  1208. std::pair<key_value_pair*, std::size_t>
  1209. detail::find_in_object(
  1210. object const& obj,
  1211. CharRange key) noexcept;
  1212. #endif
  1213. template<class InputIt>
  1214. void
  1215. construct(
  1216. InputIt first,
  1217. InputIt last,
  1218. std::size_t min_capacity,
  1219. std::input_iterator_tag);
  1220. template<class InputIt>
  1221. void
  1222. construct(
  1223. InputIt first,
  1224. InputIt last,
  1225. std::size_t min_capacity,
  1226. std::forward_iterator_tag);
  1227. template<class InputIt>
  1228. void
  1229. insert(
  1230. InputIt first,
  1231. InputIt last,
  1232. std::input_iterator_tag);
  1233. template<class InputIt>
  1234. void
  1235. insert(
  1236. InputIt first,
  1237. InputIt last,
  1238. std::forward_iterator_tag);
  1239. template< class... Args >
  1240. std::pair<iterator, bool>
  1241. emplace_impl(string_view key, Args&& ... args );
  1242. BOOST_JSON_DECL
  1243. key_value_pair*
  1244. insert_impl(
  1245. pilfered<key_value_pair> p,
  1246. std::size_t hash);
  1247. BOOST_JSON_DECL
  1248. table*
  1249. reserve_impl(std::size_t new_capacity);
  1250. BOOST_JSON_DECL
  1251. bool
  1252. equal(object const& other) const noexcept;
  1253. inline
  1254. std::size_t
  1255. growth(
  1256. std::size_t new_size) const;
  1257. inline
  1258. void
  1259. remove(
  1260. index_t& head,
  1261. key_value_pair& p) noexcept;
  1262. inline
  1263. void
  1264. destroy() noexcept;
  1265. inline
  1266. void
  1267. destroy(
  1268. key_value_pair* first,
  1269. key_value_pair* last) noexcept;
  1270. template<class FS, class FB>
  1271. auto
  1272. do_erase(
  1273. const_iterator pos,
  1274. FS small_reloc,
  1275. FB big_reloc) noexcept
  1276. -> iterator;
  1277. inline
  1278. void
  1279. reindex_relocate(
  1280. key_value_pair* src,
  1281. key_value_pair* dst) noexcept;
  1282. };
  1283. } // namespace json
  1284. } // namespace boost
  1285. #ifndef BOOST_JSON_DOCS
  1286. // boost::hash trait
  1287. namespace boost
  1288. {
  1289. namespace container_hash
  1290. {
  1291. template< class T > struct is_unordered_range;
  1292. template<>
  1293. struct is_unordered_range< json::object >
  1294. : std::true_type
  1295. {};
  1296. } // namespace container_hash
  1297. } // namespace boost
  1298. // std::hash specialization
  1299. namespace std {
  1300. template <>
  1301. struct hash< ::boost::json::object > {
  1302. BOOST_JSON_DECL
  1303. std::size_t
  1304. operator()(::boost::json::object const& jo) const noexcept;
  1305. };
  1306. } // std
  1307. #endif
  1308. // Must be included here for this file to stand alone
  1309. #include <boost/json/value.hpp>
  1310. // includes are at the bottom of <boost/json/value.hpp>
  1311. #endif