diff --git a/include/boost/unordered/detail/fca.hpp b/include/boost/unordered/detail/fca.hpp index 4a0cada1..b2012f15 100644 --- a/include/boost/unordered/detail/fca.hpp +++ b/include/boost/unordered/detail/fca.hpp @@ -114,7 +114,7 @@ to normal separate chaining implementations. */ #include -#include +#include #include #include @@ -295,8 +295,8 @@ namespace boost { Archive& ar, grouped_bucket_iterator const& x) { // requires: not at end() position - track_node_pointer(ar, x.p); - track_node_pointer(ar, x.pbg); + track_address(ar, x.p); + track_address(ar, x.pbg); } friend class boost::serialization::access; @@ -305,8 +305,8 @@ namespace boost { void serialize(Archive& ar,unsigned int) { // requires: not at end() position - serialize_node_pointer(ar, p); - serialize_node_pointer(ar, pbg); + serialize_tracked_address(ar, p); + serialize_tracked_address(ar, pbg); } }; diff --git a/include/boost/unordered/detail/foa/table.hpp b/include/boost/unordered/detail/foa/table.hpp index 8764b47b..fb883011 100644 --- a/include/boost/unordered/detail/foa/table.hpp +++ b/include/boost/unordered/detail/foa/table.hpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -201,8 +201,8 @@ private: friend void serialization_track(Archive& ar,const table_iterator& x) { if(x.p){ - track_node_pointer(ar,x.pc); - track_node_pointer(ar,x.p); + track_address(ar,x.pc); + track_address(ar,x.p); } } @@ -212,8 +212,8 @@ private: void serialize(Archive& ar,unsigned int) { if(!p)pc=nullptr; - serialize_node_pointer(ar,pc); - serialize_node_pointer(ar,p); + serialize_tracked_address(ar,pc); + serialize_tracked_address(ar,p); } unsigned char *pc=nullptr; diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index a26fc1f3..f94caa65 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include @@ -1710,7 +1710,7 @@ namespace boost { friend void serialization_track(Archive& ar, const iterator& x) { if(x.p){ - track_node_pointer(ar, x.p); + track_address(ar, x.p); serialization_track(ar, x.itb); } } @@ -1721,7 +1721,7 @@ namespace boost { void serialize(Archive& ar,unsigned int) { if(!p) itb = bucket_iterator(); - serialize_node_pointer(ar, p); + serialize_tracked_address(ar, p); ar & core::make_nvp("bucket_iterator", itb); } }; @@ -1819,7 +1819,7 @@ namespace boost { friend void serialization_track(Archive& ar, const c_iterator& x) { if(x.p){ - track_node_pointer(ar, x.p); + track_address(ar, x.p); serialization_track(ar, x.itb); } } @@ -1830,7 +1830,7 @@ namespace boost { void serialize(Archive& ar,unsigned int) { if(!p) itb = bucket_iterator(); - serialize_node_pointer(ar, p); + serialize_tracked_address(ar, p); ar & core::make_nvp("bucket_iterator", itb); } }; diff --git a/include/boost/unordered/detail/serialize_container.hpp b/include/boost/unordered/detail/serialize_container.hpp index 76506c6f..9b8c896d 100644 --- a/include/boost/unordered/detail/serialize_container.hpp +++ b/include/boost/unordered/detail/serialize_container.hpp @@ -29,12 +29,12 @@ namespace detail{ * through the following protocol: * - At saving time, for each iterator it in [x.begin(),x.end()), * serialization_track(ar,it) is ADL-called to instruct the archive to - * track the addresses of the iterator's associated node(s) via - * track_node_pointer(). + * track the positions internally pointed to by the iterator via + * track_address(). * - At loading time, these addresses are mapped to those of the equivalent - * reconstructed nodes using again serialization_track(ar,it). + * reconstructed positions using again serialization_track(ar,it). * - Serializing an iterator reduces to serializing pointers to previously - * tracked nodes via serialize_node_pointer(). + * tracked addresses via serialize_address(). */ template diff --git a/include/boost/unordered/detail/serialize_node_pointer.hpp b/include/boost/unordered/detail/serialize_tracked_address.hpp similarity index 50% rename from include/boost/unordered/detail/serialize_node_pointer.hpp rename to include/boost/unordered/detail/serialize_tracked_address.hpp index 95f37cb3..6d7d08ab 100644 --- a/include/boost/unordered/detail/serialize_node_pointer.hpp +++ b/include/boost/unordered/detail/serialize_tracked_address.hpp @@ -6,8 +6,8 @@ * See https://www.boost.org/libs/unordered for library home page. */ -#ifndef BOOST_UNORDERED_DETAIL_SERIALIZE_NODE_POINTER_HPP -#define BOOST_UNORDERED_DETAIL_SERIALIZE_NODE_POINTER_HPP +#ifndef BOOST_UNORDERED_DETAIL_SERIALIZE_TRACKED_ADDRESS_HPP +#define BOOST_UNORDERED_DETAIL_SERIALIZE_TRACKED_ADDRESS_HPP #include #include @@ -20,19 +20,19 @@ namespace boost{ namespace unordered{ namespace detail{ -/* Node pointer serialization to support iterator serialization as described +/* Tracked address serialization to support iterator serialization as described * in serialize_container.hpp. The underlying technique is to reinterpret_cast - * Node pointers to serialization_tracker pointers, which, when - * dereferenced and serialized, do not emit any serialization payload to the + * T pointers to serialization_tracker pointers, which, when dereferenced + * and serialized, do not emit any serialization payload to the * archive, but activate object tracking on the relevant addresses for later - * use with serialize_node_pointer(). + * use with serialize_tracked_address(). */ -template +template struct serialization_tracker { /* An attempt to construct a serialization_tracker means a stray address - * in the archive, that is, one without a previously tracked node. + * in the archive, that is, one without a previously tracked address. */ serialization_tracker(){throw_exception(bad_archive_exception());} @@ -40,60 +40,58 @@ struct serialization_tracker void serialize(Archive&,unsigned int){} /* no data emitted */ }; -template -void track_node_pointer(Archive& ar,NodePtr p) +template +void track_address(Archive& ar,Ptr p) { - typedef typename boost::pointer_traits ptr_traits; + typedef typename boost::pointer_traits ptr_traits; typedef typename boost::remove_const< - typename ptr_traits::element_type>::type node_type; + typename ptr_traits::element_type>::type element_type; if(p){ ar&core::make_nvp( - "node", - *reinterpret_cast*>( - const_cast( + "address", + *reinterpret_cast*>( + const_cast( boost::to_address(p)))); } } -template -void serialize_node_pointer( - Archive& ar,NodePtr& p,boost::true_type /* save */) +template +void serialize_tracked_address(Archive& ar,Ptr& p,boost::true_type /* save */) { - typedef typename boost::pointer_traits ptr_traits; + typedef typename boost::pointer_traits ptr_traits; typedef typename boost::remove_const< - typename ptr_traits::element_type>::type node_type; - typedef serialization_tracker tracker; + typename ptr_traits::element_type>::type element_type; + typedef serialization_tracker tracker; tracker* pt= const_cast( reinterpret_cast( - const_cast( + const_cast( boost::to_address(p)))); ar< -void serialize_node_pointer( - Archive& ar,NodePtr& p,boost::false_type /* load */) +template +void serialize_tracked_address(Archive& ar,Ptr& p,boost::false_type /* load */) { - typedef typename boost::pointer_traits ptr_traits; + typedef typename boost::pointer_traits ptr_traits; typedef typename boost::remove_const< - typename ptr_traits::element_type>::type node_type; - typedef serialization_tracker tracker; + typename ptr_traits::element_type>::type element_type; + typedef serialization_tracker tracker; tracker* pt; ar>>core::make_nvp("pointer",pt); - node_type* pn=const_cast( - reinterpret_cast( + element_type* pn=const_cast( + reinterpret_cast( const_cast(pt))); p=pn?ptr_traits::pointer_to(*pn):0; } -template -void serialize_node_pointer(Archive& ar,NodePtr& p) +template +void serialize_tracked_address(Archive& ar,Ptr& p) { - serialize_node_pointer( + serialize_tracked_address( ar,p, boost::integral_constant()); }