Boost logo

Boost-Commit :

From: ramey_at_[hidden]
Date: 2007-11-28 23:58:42


Author: ramey
Date: 2007-11-28 23:58:41 EST (Wed, 28 Nov 2007)
New Revision: 41453
URL: http://svn.boost.org/trac/boost/changeset/41453

Log:
gcc, vc 7.1 and vc8.0 passing all tests !!!
Text files modified:
   branches/serialization_next_release/boost/libs/serialization/src/extended_type_info.cpp | 6 ----
   branches/serialization_next_release/boost/libs/serialization/src/void_cast.cpp | 47 ++++++++++++++++++++++++++++++++++-----
   2 files changed, 42 insertions(+), 11 deletions(-)

Modified: branches/serialization_next_release/boost/libs/serialization/src/extended_type_info.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/src/extended_type_info.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/src/extended_type_info.cpp 2007-11-28 23:58:41 EST (Wed, 28 Nov 2007)
@@ -55,7 +55,7 @@
         // for exported types, use the string key so that
         // multiple instances in different translation units
         // can be matched up
- return -1 == std::strcmp(l, r);
+ return std::strcmp(l, r) < 0;
     }
 };
 
@@ -72,10 +72,6 @@
     ~extended_type_info_arg(){
         m_key = NULL;
     }
- virtual bool is_less_than(const extended_type_info &rhs) const {
- key_compare kc;
- return kc(this, & rhs);
- }
 };
 
 } // namespace detail

Modified: branches/serialization_next_release/boost/libs/serialization/src/void_cast.cpp
==============================================================================
--- branches/serialization_next_release/boost/libs/serialization/src/void_cast.cpp (original)
+++ branches/serialization_next_release/boost/libs/serialization/src/void_cast.cpp 2007-11-28 23:58:41 EST (Wed, 28 Nov 2007)
@@ -16,7 +16,7 @@
 #include <cassert>
 
 // STL
-#include <set>
+#include <vector>
 #include <functional>
 #include <algorithm>
 #include <cassert>
@@ -33,6 +33,7 @@
 namespace serialization {
 namespace void_cast_detail {
 
+#if 0
 // registry of casting objects
 struct void_caster_compare
 {
@@ -50,8 +51,21 @@
 };
 
 typedef std::set<const void_caster *, void_caster_compare> set_type;
+#endif
+
+typedef std::vector<const void_caster *> set_type;
+
 typedef boost::serialization::singleton<set_type> void_caster_registry;
 
+inline bool
+void_caster::operator==(void_caster const & rhs) const{
+ if(m_derived != rhs.m_derived)
+ return false;
+ if(m_base != rhs.m_base)
+ return false;
+ return true;
+}
+
 // implementation of void caster base class
 BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
 void_caster::void_caster(
@@ -64,7 +78,7 @@
 
 BOOST_SERIALIZATION_DECL(void)
 void_caster::static_register() const {
- void_caster_registry::get_mutable_instance().insert(this);
+ void_caster_registry::get_mutable_instance().push_back(this);
     // to do - add new void_caster_derived entries
     // which can be generated by adding this new primitive
     /*
@@ -81,7 +95,7 @@
     void_cast_detail::set_type & st
         = void_caster_registry::get_mutable_instance();
     void_cast_detail::set_type::iterator it;
- it = st.find(this);
+ it = std::find(st.begin(), st.end(), this);
     assert(st.end() != it);
     st.erase(it);
     // to do - remove all void_caster_derived entries
@@ -95,6 +109,7 @@
     */
 }
 
+#if 0
 // implementation of shortcut void caster
 class void_caster_derived : public void_caster
 {
@@ -122,6 +137,7 @@
         this->static_unregister();
     }
 };
+#endif
 
 // just used as a search key
 class void_caster_argument : public void_caster
@@ -146,6 +162,17 @@
     ~void_caster_argument(){};
 };
 
+struct match {
+ void_cast_detail::void_caster_argument const * const m_ca;
+
+ match(void_cast_detail::void_caster_argument const * const ca) :
+ m_ca(ca)
+ {}
+ bool operator()(const void_cast_detail::void_caster * vc){
+ return * vc == * m_ca;
+ };
+};
+
 } // namespace void_cast_detail
 
 // Given a void *, assume that it really points to an instance of one type
@@ -168,7 +195,11 @@
     void_cast_detail::set_type::const_iterator it;
     void_cast_detail::void_caster_argument ca(derived, base);
 
- it = s.find(& ca);
+ it = std::find_if(
+ s.begin(),
+ s.end(),
+ void_cast_detail::match(& ca)
+ );
     
     // if so
     if (s.end() != it)
@@ -210,8 +241,12 @@
     void_cast_detail::set_type::const_iterator it;
     void_cast_detail::void_caster_argument ca(derived, base);
 
- it = s.find(& ca);
-
+ it = std::find_if(
+ s.begin(),
+ s.end(),
+ void_cast_detail::match(& ca)
+ );
+
     // if so
     if (s.end() != it)
         // we're done


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk