Ticket #1711: header_ordering_fix.patch
File header_ordering_fix.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 158 #define BOOST_SERIALIZATION_FORCE_DEP_NAME_LOOKUP(T) \ 159 namespace boost { namespace archive { namespace detail { \ 160 template<> struct force_dependent_name_lookup<T> : public mpl::true_{}; \ 161 }}} 162 147 163 #define BOOST_CLASS_EXPORT_GUID(T, K) \ 164 BOOST_SERIALIZATION_FORCE_DEP_NAME_LOOKUP(T) \ 148 165 namespace \ 149 166 { \ 150 167 ::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) {} 25 template<typename Archive> 26 struct is_oarchive : public Archive::is_loading {}; 28 27 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 28 // ADL causes _ptr_serialization_support to be instantiated for all 29 // archives that get registered. This function is actually called. 30 // See also: boost/serialization/export.hpp 34 31 # define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \ 35 32 namespace boost { namespace archive { namespace detail { \ 36 33 \ 37 34 template <class Serializable> \ 38 typename _ptr_serialization_support<Archive, Serializable>::type \ 39 instantiate_ptr_serialization( Serializable*, Archive* ); \ 35 typename boost::enable_if<is_oarchive<Archive>, \ 36 typename \ 37 _ptr_serialization_support<Archive, \ 38 Serializable>::type >::type \ 39 instantiate_ptr_serialization( Serializable*, \ 40 Archive*, \ 41 boost::mpl::true_){} \ 40 42 \ 41 43 }}} 42 44 -
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