Ticket #1711: header_ordering_fix.2.patch
File header_ordering_fix.2.patch, 5.0 KB (added by , 15 years ago) |
---|
-
boost/serialization/export.hpp
112 112 ); 113 113 } 114 114 115 // This trait is used to force the compiler to do a dependent name 116 // lookup on instantiate_ptr_serialization. When classes are exported, 117 // they specialize this trait to inherit from mpl::true_. This in 118 // turn causes a different set of overloads to be selected. The key 119 // thing is that the name lookup is delayed to instantiation time. 120 template<typename T> 121 struct force_dependent_name_lookup 122 : boost::mpl::false_ {}; 123 115 124 template<class T> 116 125 struct guid_initializer 117 126 { … … 119 128 // generates the statically-initialized objects whose constructors 120 129 // register the information allowing serialization of T objects 121 130 // through pointers to their base classes. 122 instantiate_ptr_serialization((T*)0, 0); 131 instantiate_ptr_serialization((T*)0,0, 132 typename force_dependent_name_lookup<T>::type()); 123 133 return *this; 124 134 } 125 135 const guid_initializer & export_guid(char const* key, mpl::true_){ … … 144 154 } // namespace archive 145 155 } // namespace boost 146 156 157 // Internal macro: This macro specializes 158 // force_dependent_name_loookup. See explanation above. 159 #define BOOST_SERIALIZATION_FORCE_DEP_NAME_LOOKUP(T) \ 160 namespace boost { namespace archive { namespace detail { \ 161 template<> struct force_dependent_name_lookup<T> : public mpl::true_{}; \ 162 }}} 163 147 164 #define BOOST_CLASS_EXPORT_GUID(T, K) \ 165 BOOST_SERIALIZATION_FORCE_DEP_NAME_LOOKUP(T) \ 148 166 namespace \ 149 167 { \ 150 168 ::boost::archive::detail::guid_initializer< T > const & \ -
boost/archive/detail/register_archive.hpp
4 4 #ifndef BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP 5 5 # define BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP 6 6 7 #include <boost/utility/enable_if.hpp> 8 7 9 namespace boost { namespace archive { namespace detail { 8 10 9 11 template <class Archive, class Serializable> … … 17 19 struct _ptr_serialization_support 18 20 : ptr_serialization_support<Archive,Serializable> 19 21 { 20 typedef inttype;22 typedef void type; 21 23 }; 22 24 23 // This function gets called, but its only purpose is to participate 24 // in overload resolution with the functions declared by 25 // BOOST_SERIALIZATION_REGISTER_ARCHIVE, below. 26 template <class Serializable> 27 void instantiate_ptr_serialization(Serializable*, int) {} 28 29 // The function declaration generated by this macro never actually 30 // gets called, but its return type gets instantiated, and that's 31 // enough to cause registration of serialization functions between 32 // Archive and any exported Serializable type. See also: 33 // boost/serialization/export.hpp 25 // enable_if causes _ptr_serialization_support to be instantiated for all 26 // archives that get registered. This function is actually called. 27 // See also: boost/serialization/export.hpp 34 28 # define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \ 35 29 namespace boost { namespace archive { namespace detail { \ 36 30 \ 37 31 template <class Serializable> \ 38 typename _ptr_serialization_support<Archive, Serializable>::type \ 39 instantiate_ptr_serialization( Serializable*, Archive* ); \ 32 typename boost::enable_if<Archive::is_loading, \ 33 typename \ 34 _ptr_serialization_support<Archive, \ 35 Serializable>::type >::type \ 36 instantiate_ptr_serialization( Serializable*, \ 37 Archive*, \ 38 boost::mpl::true_){} \ 40 39 \ 41 40 }}} 42 41 -
libs/serialization/test/test_exported.cpp
18 18 } 19 19 #endif 20 20 21 #include <boost/serialization/export.hpp> 21 22 #include <boost/serialization/base_object.hpp> 22 23 #include <boost/serialization/type_info_implementation.hpp> 23 24 #include <boost/archive/archive_exception.hpp> 24 25 #include "test_tools.hpp" 25 #include <boost/serialization/export.hpp>26 26 27 27 #include "base.hpp" 28 28