diff --git a/doc/unordered/changes.adoc b/doc/unordered/changes.adoc index ed0640ac..f03399b9 100644 --- a/doc/unordered/changes.adoc +++ b/doc/unordered/changes.adoc @@ -14,7 +14,7 @@ with serial and parallel variants. `boost::concurrent_flat_map` and vice versa. * Added debug mode mechanisms for detecting illegal reentrancies into a `boost::concurrent_flat_map` from user code. - +* Added Boost.Serialization support to all containers and their (non-local) iterator types. == Release 1.83.0 - Major update * Added `boost::concurrent_flat_map`, a fast, thread-safe hashmap based on open addressing. diff --git a/doc/unordered/concurrent_flat_map.adoc b/doc/unordered/concurrent_flat_map.adoc index f059ca5c..bcfc719e 100644 --- a/doc/unordered/concurrent_flat_map.adoc +++ b/doc/unordered/concurrent_flat_map.adoc @@ -1518,3 +1518,33 @@ Equivalent to ----- c.xref:#concurrent_flat_map_erase_if[erase_if](pred); ----- + +=== Serialization + +``concurrent_flat_map``s can be archived/retrieved by means of +link:../../../serialization/index.html[Boost.Serialization^] using the API provided +by this library. Both regular and XML archives are supported. + +==== Saving an concurrent_flat_map to an archive + +Saves all the elements of a `concurrent_flat_map` `x` to an archive (XML archive) `ar`. + +[horizontal] +Requires:;; `std::remove_const::type` and `std::remove_const::type` +are serializable (XML serializable), and they do support Boost.Serialization +`save_construct_data`/`load_construct_data` protocol (automatically suported by +https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^] +types). +Concurrency:;; Blocking on `x`. + +--- + +==== Loading an concurrent_flat_map from an archive + +Deletes all preexisting elements of a `concurrent_flat_map` `x` and inserts +from an archive (XML archive) `ar` restored copies of the elements of the +original `concurrent_flat_map` `other` saved to the storage read by `ar`. + +[horizontal] +Requires:;; `x.key_equal()` is functionally equivalent to `other.key_equal()`. +Concurrency:;; Blocking on `x`. diff --git a/doc/unordered/unordered_flat_map.adoc b/doc/unordered/unordered_flat_map.adoc index 543db307..7018433b 100644 --- a/doc/unordered/unordered_flat_map.adoc +++ b/doc/unordered/unordered_flat_map.adoc @@ -1464,4 +1464,54 @@ for (auto i = c.begin(), last = c.end(); i != last; ) { return original_size - c.size(); ``` +=== Serialization + +``unordered_flat_map``s can be archived/retrieved by means of +link:../../../serialization/index.html[Boost.Serialization^] using the API provided +by this library. Both regular and XML archives are supported. + +==== Saving an unordered_flat_map to an archive + +Saves all the elements of an `unordered_flat_map` `x` to an archive (XML archive) `ar`. + +[horizontal] +Requires:;; `std::remove_const::type` and `std::remove_const::type` +are serializable (XML serializable), and they do support Boost.Serialization +`save_construct_data`/`load_construct_data` protocol (automatically suported by +https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^] +types). + --- + +==== Loading an unordered_flat_map from an archive + +Deletes all preexisting elements of an `unordered_flat_map` `x` and inserts +from an archive (XML archive) `ar` restored copies of the elements of the +original `unordered_flat_map` `other` saved to the storage read by `ar`. + +[horizontal] +Requires:;; `x.key_equal()` is functionally equivalent to `other.key_equal()`. + +--- + +==== Saving an iterator/const_iterator to an archive + +Saves the positional information of an `iterator` (`const_iterator`) `it` +to an archive (XML archive) `ar`. `it` can be and `end()` iterator. + +[horizontal] +Requires:;; The `unordered_flat_map` `x` pointed to by `it` has been previously saved to `ar`, +and no modifying operations have been issued on `x` between saving of `x` and +saving of `it`. + +--- + +==== Loading an iterator/const_iterator from an archive + +Makes an `iterator` (`const_iterator`) `it` point to the restored position of +the original `iterator` (`const_iterator`) saved to the storage read by +an archive (XML archive) `ar`. + +[horizontal] +Requires:;; If `x` is the `unordered_flat_map` `it` points to, no modifying operations +have been issued on `x` between loading of `x` and loading of `it`. diff --git a/doc/unordered/unordered_flat_set.adoc b/doc/unordered/unordered_flat_set.adoc index 391d7e12..68410ba5 100644 --- a/doc/unordered/unordered_flat_set.adoc +++ b/doc/unordered/unordered_flat_set.adoc @@ -1201,4 +1201,54 @@ for (auto i = c.begin(), last = c.end(); i != last; ) { return original_size - c.size(); ``` +=== Serialization + +``unordered_flat_set``s can be archived/retrieved by means of +link:../../../serialization/index.html[Boost.Serialization^] using the API provided +by this library. Both regular and XML archives are supported. + +==== Saving an unordered_flat_set to an archive + +Saves all the elements of an `unordered_flat_set` `x` to an archive (XML archive) `ar`. + +[horizontal] +Requires:;; `value_type` +is serializable (XML serializable), and it supports Boost.Serialization +`save_construct_data`/`load_construct_data` protocol (automatically suported by +https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^] +types). + --- + +==== Loading an unordered_flat_set from an archive + +Deletes all preexisting elements of an `unordered_flat_set` `x` and inserts +from an archive (XML archive) `ar` restored copies of the elements of the +original `unordered_flat_set` `other` saved to the storage read by `ar`. + +[horizontal] +Requires:;; `x.key_equal()` is functionally equivalent to `other.key_equal()`. + +--- + +==== Saving an iterator/const_iterator to an archive + +Saves the positional information of an `iterator` (`const_iterator`) `it` +to an archive (XML archive) `ar`. `it` can be and `end()` iterator. + +[horizontal] +Requires:;; The `unordered_flat_set` `x` pointed to by `it` has been previously saved to `ar`, +and no modifying operations have been issued on `x` between saving of `x` and +saving of `it`. + +--- + +==== Loading an iterator/const_iterator from an archive + +Makes an `iterator` (`const_iterator`) `it` point to the restored position of +the original `iterator` (`const_iterator`) saved to the storage read by +an archive (XML archive) `ar`. + +[horizontal] +Requires:;; If `x` is the `unordered_flat_set` `it` points to, no modifying operations +have been issued on `x` between loading of `x` and loading of `it`. diff --git a/doc/unordered/unordered_map.adoc b/doc/unordered/unordered_map.adoc index 02d95ac2..d01944a0 100644 --- a/doc/unordered/unordered_map.adoc +++ b/doc/unordered/unordered_map.adoc @@ -323,7 +323,12 @@ The elements are organized into buckets. Keys with the same hash code are stored The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash. ---- +=== Configuration macros + +==== `BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0` + +Globally define this macro to support loading of ``unordered_map``s saved to +a Boost.Serialization archive with a version of Boost prior to Boost 1.84. === Typedefs @@ -1825,4 +1830,59 @@ for (auto i = c.begin(), last = c.end(); i != last; ) { return original_size - c.size(); ``` +=== Serialization + +``unordered_map``s can be archived/retrieved by means of +link:../../../serialization/index.html[Boost.Serialization^] using the API provided +by this library. Both regular and XML archives are supported. + +==== Saving an unordered_map to an archive + +Saves all the elements of an `unordered_map` `x` to an archive (XML archive) `ar`. + +[horizontal] +Requires:;; `std::remove_const::type` and `std::remove_const::type` +are serializable (XML serializable), and they do support Boost.Serialization +`save_construct_data`/`load_construct_data` protocol (automatically suported by +https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^] +types). + --- + +==== Loading an unordered_map from an archive + +Deletes all preexisting elements of an `unordered_map` `x` and inserts +from an archive (XML archive) `ar` restored copies of the elements of the +original `unordered_map` `other` saved to the storage read by `ar`. + +[horizontal] +Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/EmplaceConstructible[EmplaceConstructible^] +from `(std::remove_const::type&&, std::remove_const::type&&)`. +`x.key_equal()` is functionally equivalent to `other.key_equal()`. +Note:;; If the archive was saved using a release of Boost prior to Boost 1.84, +the configuration macro `BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0` +has to be globally defined for this operation to succeed; otherwise, an exception is thrown. + +--- + +==== Saving an iterator/const_iterator to an archive + +Saves the positional information of an `iterator` (`const_iterator`) `it` +to an archive (XML archive) `ar`. `it` can be and `end()` iterator. + +[horizontal] +Requires:;; The `unordered_map` `x` pointed to by `it` has been previously saved to `ar`, +and no modifying operations have been issued on `x` between saving of `x` and +saving of `it`. + +--- + +==== Loading an iterator/const_iterator from an archive + +Makes an `iterator` (`const_iterator`) `it` point to the restored position of +the original `iterator` (`const_iterator`) saved to the storage read by +an archive (XML archive) `ar`. + +[horizontal] +Requires:;; If `x` is the `unordered_map` `it` points to, no modifying operations +have been issued on `x` between loading of `x` and loading of `it`. diff --git a/doc/unordered/unordered_multimap.adoc b/doc/unordered/unordered_multimap.adoc index 7a6a09d7..52b23d9a 100644 --- a/doc/unordered/unordered_multimap.adoc +++ b/doc/unordered/unordered_multimap.adoc @@ -290,6 +290,13 @@ The elements are organized into buckets. Keys with the same hash code are stored The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash. +=== Configuration macros + +==== `BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0` + +Globally define this macro to support loading of ``unordered_multimap``s saved to +a Boost.Serialization archive with a version of Boost prior to Boost 1.84. + === Typedefs [source,c++,subs=+quotes] @@ -1552,4 +1559,59 @@ for (auto i = c.begin(), last = c.end(); i != last; ) { return original_size - c.size(); ``` +=== Serialization + +``unordered_multimap``s can be archived/retrieved by means of +link:../../../serialization/index.html[Boost.Serialization^] using the API provided +by this library. Both regular and XML archives are supported. + +==== Saving an unordered_multimap to an archive + +Saves all the elements of an `unordered_multimap` `x` to an archive (XML archive) `ar`. + +[horizontal] +Requires:;; `std::remove_const::type` and `std::remove_const::type` +are serializable (XML serializable), and they do support Boost.Serialization +`save_construct_data`/`load_construct_data` protocol (automatically suported by +https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^] +types). + --- + +==== Loading an unordered_multimap from an archive + +Deletes all preexisting elements of an `unordered_multimap` `x` and inserts +from an archive (XML archive) `ar` restored copies of the elements of the +original `unordered_multimap` `other` saved to the storage read by `ar`. + +[horizontal] +Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/EmplaceConstructible[EmplaceConstructible^] +from `(std::remove_const::type&&, std::remove_const::type&&)`. +`x.key_equal()` is functionally equivalent to `other.key_equal()`. +Note:;; If the archive was saved using a release of Boost prior to Boost 1.84, +the configuration macro `BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0` +has to be globally defined for this operation to succeed; otherwise, an exception is thrown. + +--- + +==== Saving an iterator/const_iterator to an archive + +Saves the positional information of an `iterator` (`const_iterator`) `it` +to an archive (XML archive) `ar`. `it` can be and `end()` iterator. + +[horizontal] +Requires:;; The `unordered_multimap` `x` pointed to by `it` has been previously saved to `ar`, +and no modifying operations have been issued on `x` between saving of `x` and +saving of `it`. + +--- + +==== Loading an iterator/const_iterator from an archive + +Makes an `iterator` (`const_iterator`) `it` point to the restored position of +the original `iterator` (`const_iterator`) saved to the storage read by +an archive (XML archive) `ar`. + +[horizontal] +Requires:;; If `x` is the `unordered_multimap` `it` points to, no modifying operations +have been issued on `x` between loading of `x` and loading of `it`. diff --git a/doc/unordered/unordered_multiset.adoc b/doc/unordered/unordered_multiset.adoc index 017ef5c2..a1ee1a57 100644 --- a/doc/unordered/unordered_multiset.adoc +++ b/doc/unordered/unordered_multiset.adoc @@ -278,7 +278,12 @@ The elements are organized into buckets. Keys with the same hash code are stored The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash. ---- +=== Configuration macros + +==== `BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0` + +Globally define this macro to support loading of ``unordered_multiset``s saved to +a Boost.Serialization archive with a version of Boost prior to Boost 1.84. === Typedefs @@ -1485,4 +1490,58 @@ for (auto i = c.begin(), last = c.end(); i != last; ) { return original_size - c.size(); ``` +=== Serialization + +``unordered_multiset``s can be archived/retrieved by means of +link:../../../serialization/index.html[Boost.Serialization^] using the API provided +by this library. Both regular and XML archives are supported. + +==== Saving an unordered_multiset to an archive + +Saves all the elements of an `unordered_multiset` `x` to an archive (XML archive) `ar`. + +[horizontal] +Requires:;; `value_type` +is serializable (XML serializable), and it supports Boost.Serialization +`save_construct_data`/`load_construct_data` protocol (automatically suported by +https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^] +types). + --- + +==== Loading an unordered_multiset from an archive + +Deletes all preexisting elements of an `unordered_multiset` `x` and inserts +from an archive (XML archive) `ar` restored copies of the elements of the +original `unordered_multiset` `other` saved to the storage read by `ar`. + +[horizontal] +Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/MoveInsertable[MoveInsertable^]. +`x.key_equal()` is functionally equivalent to `other.key_equal()`. +Note:;; If the archive was saved using a release of Boost prior to Boost 1.84, +the configuration macro `BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0` +has to be globally defined for this operation to succeed; otherwise, an exception is thrown. + +--- + +==== Saving an iterator/const_iterator to an archive + +Saves the positional information of an `iterator` (`const_iterator`) `it` +to an archive (XML archive) `ar`. `it` can be and `end()` iterator. + +[horizontal] +Requires:;; The `unordered_multiset` `x` pointed to by `it` has been previously saved to `ar`, +and no modifying operations have been issued on `x` between saving of `x` and +saving of `it`. + +--- + +==== Loading an iterator/const_iterator from an archive + +Makes an `iterator` (`const_iterator`) `it` point to the restored position of +the original `iterator` (`const_iterator`) saved to the storage read by +an archive (XML archive) `ar`. + +[horizontal] +Requires:;; If `x` is the `unordered_multiset` `it` points to, no modifying operations +have been issued on `x` between loading of `x` and loading of `it`. diff --git a/doc/unordered/unordered_node_map.adoc b/doc/unordered/unordered_node_map.adoc index 9930ebfc..fcc46d5c 100644 --- a/doc/unordered/unordered_node_map.adoc +++ b/doc/unordered/unordered_node_map.adoc @@ -1545,4 +1545,57 @@ for (auto i = c.begin(), last = c.end(); i != last; ) { return original_size - c.size(); ``` +=== Serialization + +``unordered_node_map``s can be archived/retrieved by means of +link:../../../serialization/index.html[Boost.Serialization^] using the API provided +by this library. Both regular and XML archives are supported. + +==== Saving an unordered_node_map to an archive + +Saves all the elements of an `unordered_node_map` `x` to an archive (XML archive) `ar`. + +[horizontal] +Requires:;; `std::remove_const::type` and `std::remove_const::type` +are serializable (XML serializable), and they do support Boost.Serialization +`save_construct_data`/`load_construct_data` protocol (automatically suported by +https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^] +types). + --- + +==== Loading an unordered_node_map from an archive + +Deletes all preexisting elements of an `unordered_node_map` `x` and inserts +from an archive (XML archive) `ar` restored copies of the elements of the +original `unordered_node_map` `other` saved to the storage read by `ar`. + +[horizontal] +Requires:;; `key_type` and `mapped_type` are constructible from +`std::remove_const::type&&` and `std::remove_const::type&&`, +respectively. +`x.key_equal()` is functionally equivalent to `other.key_equal()`. + +--- + +==== Saving an iterator/const_iterator to an archive + +Saves the positional information of an `iterator` (`const_iterator`) `it` +to an archive (XML archive) `ar`. `it` can be and `end()` iterator. + +[horizontal] +Requires:;; The `unordered_node_map` `x` pointed to by `it` has been previously saved to `ar`, +and no modifying operations have been issued on `x` between saving of `x` and +saving of `it`. + +--- + +==== Loading an iterator/const_iterator from an archive + +Makes an `iterator` (`const_iterator`) `it` point to the restored position of +the original `iterator` (`const_iterator`) saved to the storage read by +an archive (XML archive) `ar`. + +[horizontal] +Requires:;; If `x` is the `unordered_node_map` `it` points to, no modifying operations +have been issued on `x` between loading of `x` and loading of `it`. diff --git a/doc/unordered/unordered_node_set.adoc b/doc/unordered/unordered_node_set.adoc index 81633d96..44a7fc9e 100644 --- a/doc/unordered/unordered_node_set.adoc +++ b/doc/unordered/unordered_node_set.adoc @@ -1302,4 +1302,55 @@ for (auto i = c.begin(), last = c.end(); i != last; ) { return original_size - c.size(); ``` +=== Serialization + +``unordered_node_set``s can be archived/retrieved by means of +link:../../../serialization/index.html[Boost.Serialization^] using the API provided +by this library. Both regular and XML archives are supported. + +==== Saving an unordered_node_set to an archive + +Saves all the elements of an `unordered_node_set` `x` to an archive (XML archive) `ar`. + +[horizontal] +Requires:;; `value_type` +is serializable (XML serializable), and it supports Boost.Serialization +`save_construct_data`/`load_construct_data` protocol (automatically suported by +https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^] +types). + --- + +==== Loading an unordered_node_set from an archive + +Deletes all preexisting elements of an `unordered_node_set` `x` and inserts +from an archive (XML archive) `ar` restored copies of the elements of the +original `unordered_node_set` `other` saved to the storage read by `ar`. + +[horizontal] +Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/MoveInsertable[MoveInsertable^]. +`x.key_equal()` is functionally equivalent to `other.key_equal()`. + +--- + +==== Saving an iterator/const_iterator to an archive + +Saves the positional information of an `iterator` (`const_iterator`) `it` +to an archive (XML archive) `ar`. `it` can be and `end()` iterator. + +[horizontal] +Requires:;; The `unordered_node_set` `x` pointed to by `it` has been previously saved to `ar`, +and no modifying operations have been issued on `x` between saving of `x` and +saving of `it`. + +--- + +==== Loading an iterator/const_iterator from an archive + +Makes an `iterator` (`const_iterator`) `it` point to the restored position of +the original `iterator` (`const_iterator`) saved to the storage read by +an archive (XML archive) `ar`. + +[horizontal] +Requires:;; If `x` is the `unordered_node_set` `it` points to, no modifying operations +have been issued on `x` between loading of `x` and loading of `it`. diff --git a/doc/unordered/unordered_set.adoc b/doc/unordered/unordered_set.adoc index 57b6e6f4..4b50b21f 100644 --- a/doc/unordered/unordered_set.adoc +++ b/doc/unordered/unordered_set.adoc @@ -279,7 +279,12 @@ The elements are organized into buckets. Keys with the same hash code are stored The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash. ---- +=== Configuration macros + +==== `BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0` + +Globally define this macro to support loading of ``unordered_set``s saved to +a Boost.Serialization archive with a version of Boost prior to Boost 1.84. === Typedefs @@ -1550,4 +1555,58 @@ for (auto i = c.begin(), last = c.end(); i != last; ) { return original_size - c.size(); ``` +=== Serialization + +``unordered_set``s can be archived/retrieved by means of +link:../../../serialization/index.html[Boost.Serialization^] using the API provided +by this library. Both regular and XML archives are supported. + +==== Saving an unordered_set to an archive + +Saves all the elements of an `unordered_set` `x` to an archive (XML archive) `ar`. + +[horizontal] +Requires:;; `value_type` +is serializable (XML serializable), and it supports Boost.Serialization +`save_construct_data`/`load_construct_data` protocol (automatically suported by +https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^] +types). + --- + +==== Loading an unordered_set from an archive + +Deletes all preexisting elements of an `unordered_set` `x` and inserts +from an archive (XML archive) `ar` restored copies of the elements of the +original `unordered_set` `other` saved to the storage read by `ar`. + +[horizontal] +Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/MoveInsertable[MoveInsertable^]. +`x.key_equal()` is functionally equivalent to `other.key_equal()`. +Note:;; If the archive was saved using a release of Boost prior to Boost 1.84, +the configuration macro `BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0` +has to be globally defined for this operation to succeed; otherwise, an exception is thrown. + +--- + +==== Saving an iterator/const_iterator to an archive + +Saves the positional information of an `iterator` (`const_iterator`) `it` +to an archive (XML archive) `ar`. `it` can be and `end()` iterator. + +[horizontal] +Requires:;; The `unordered_set` `x` pointed to by `it` has been previously saved to `ar`, +and no modifying operations have been issued on `x` between saving of `x` and +saving of `it`. + +--- + +==== Loading an iterator/const_iterator from an archive + +Makes an `iterator` (`const_iterator`) `it` point to the restored position of +the original `iterator` (`const_iterator`) saved to the storage read by +an archive (XML archive) `ar`. + +[horizontal] +Requires:;; If `x` is the `unordered_set` `it` points to, no modifying operations +have been issued on `x` between loading of `x` and loading of `it`.