|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54753 - trunk/boost/serialization
From: ramey_at_[hidden]
Date: 2009-07-07 00:01:08
Author: ramey
Date: 2009-07-07 00:01:07 EDT (Tue, 07 Jul 2009)
New Revision: 54753
URL: http://svn.boost.org/trac/boost/changeset/54753
Log:
Fixed misc bugs
void cast
added dll tests
Text files modified:
trunk/boost/serialization/base_object.hpp | 3 +--
trunk/boost/serialization/extended_type_info.hpp | 12 ++----------
trunk/boost/serialization/factory.hpp | 2 +-
trunk/boost/serialization/vector.hpp | 23 ++++++++++-------------
trunk/boost/serialization/void_cast.hpp | 38 ++++++++++++++++++++++++++------------
5 files changed, 40 insertions(+), 38 deletions(-)
Modified: trunk/boost/serialization/base_object.hpp
==============================================================================
--- trunk/boost/serialization/base_object.hpp (original)
+++ trunk/boost/serialization/base_object.hpp 2009-07-07 00:01:07 EDT (Tue, 07 Jul 2009)
@@ -84,8 +84,7 @@
};
} // namespace detail
-
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
+#if defined(__BORLANDC__) && __BORLANDC__ < 0x610
template<class Base, class Derived>
const Base &
base_object(const Derived & d)
Modified: trunk/boost/serialization/extended_type_info.hpp
==============================================================================
--- trunk/boost/serialization/extended_type_info.hpp (original)
+++ trunk/boost/serialization/extended_type_info.hpp 2009-07-07 00:01:07 EDT (Tue, 07 Jul 2009)
@@ -43,16 +43,8 @@
// so that different derivations of this class can be simultaneously
// included in implementation of sets and maps.
const unsigned int m_type_info_key;
- virtual bool
- is_less_than(const extended_type_info & /*rhs*/) const {
- assert(false);
- return false;
- };
- virtual bool
- is_equal(const extended_type_info & /*rhs*/) const {
- assert(false);
- return false;
- };
+ virtual bool is_less_than(const extended_type_info & /*rhs*/) const = 0;
+ virtual bool is_equal(const extended_type_info & /*rhs*/) const = 0;
void key_unregister();
protected:
const char * m_key;
Modified: trunk/boost/serialization/factory.hpp
==============================================================================
--- trunk/boost/serialization/factory.hpp (original)
+++ trunk/boost/serialization/factory.hpp 2009-07-07 00:01:07 EDT (Tue, 07 Jul 2009)
@@ -16,7 +16,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
-#include <cstdarg>
+#include <cstdarg> // valist
#include <cstddef> // NULL
#include <boost/preprocessor/control/if.hpp>
Modified: trunk/boost/serialization/vector.hpp
==============================================================================
--- trunk/boost/serialization/vector.hpp (original)
+++ trunk/boost/serialization/vector.hpp 2009-07-07 00:01:07 EDT (Tue, 07 Jul 2009)
@@ -31,10 +31,9 @@
// default is being compatible with version 1.34.1 files, not 1.35 files
#ifndef BOOST_SERIALIZATION_VECTOR_VERSION
-#define BOOST_SERIALIZATION_VECTOR_VERSION 3
+#define BOOST_SERIALIZATION_VECTOR_VERSION 4
#endif
-
namespace boost {
namespace serialization {
@@ -83,12 +82,10 @@
){
const collection_size_type count(t.size());
ar << BOOST_SERIALIZATION_NVP(count);
- if(BOOST_SERIALIZATION_VECTOR_VERSION < ar.get_library_version()) {
- const unsigned int item_version = version<U>::value;
- ar << BOOST_SERIALIZATION_NVP(item_version);
- }
- if (!t.empty())
- ar << make_array(detail::get_data(t),t.size());
+ const unsigned int item_version = version<U>::value;
+ ar << BOOST_SERIALIZATION_NVP(item_version);
+ if (!t.empty())
+ ar << make_array(detail::get_data(t),t.size());
}
template<class Archive, class U, class Allocator>
@@ -105,7 +102,7 @@
if(BOOST_SERIALIZATION_VECTOR_VERSION < ar.get_library_version())
ar >> BOOST_SERIALIZATION_NVP(item_version);
if (!t.empty())
- ar >> make_array(detail::get_data(t),t.size());
+ ar >> make_array(detail::get_data(t),t.size());
}
// dispatch to either default or optimized versions
@@ -118,8 +115,8 @@
){
typedef BOOST_DEDUCED_TYPENAME
boost::serialization::use_array_optimization<Archive>::template apply<
- BOOST_DEDUCED_TYPENAME remove_const<U>::type
- >::type use_optimized;
+ BOOST_DEDUCED_TYPENAME remove_const<U>::type
+ >::type use_optimized;
save(ar,t,file_version, use_optimized());
}
@@ -131,8 +128,8 @@
){
typedef BOOST_DEDUCED_TYPENAME
boost::serialization::use_array_optimization<Archive>::template apply<
- BOOST_DEDUCED_TYPENAME remove_const<U>::type
- >::type use_optimized;
+ BOOST_DEDUCED_TYPENAME remove_const<U>::type
+ >::type use_optimized;
load(ar,t,file_version, use_optimized());
}
Modified: trunk/boost/serialization/void_cast.hpp
==============================================================================
--- trunk/boost/serialization/void_cast.hpp (original)
+++ trunk/boost/serialization/void_cast.hpp 2009-07-07 00:01:07 EDT (Tue, 07 Jul 2009)
@@ -101,7 +101,7 @@
void const * const
);
// cw 8.3 requires this!!
- void_caster& operator=(void_caster const &);
+// void_caster& operator=(void_caster const &);
protected:
void recursive_register(bool includes_virtual_base = false) const;
void recursive_unregister() const;
@@ -109,19 +109,28 @@
// Data members
const extended_type_info * m_derived;
const extended_type_info * m_base;
- const std::ptrdiff_t m_difference;
+ /*const*/ std::ptrdiff_t m_difference;
virtual bool is_shortcut() const {
return false;
}
// note that void_casters are keyed on value of
- // addresses to member extended type info records
- bool operator<(const void_caster & lhs) const {
- if(m_derived < lhs.m_derived)
- return true;
- if(m_derived == lhs.m_derived)
- if(m_base < lhs.m_base)
- return true;
- return false;
+ // member extended type info records - NOT their
+ // addresses. This is necessary in order for the
+ // void cast operations to work across dll and exe
+ // module boundries.
+ bool operator<(const void_caster & rhs) const;
+ bool operator>(const void_caster & rhs) const {
+ return ! (rhs < *this);
+ }
+
+ void_caster & operator=(const void_caster & rhs){
+ m_derived = rhs.m_derived;
+ m_base = rhs.m_base;
+ m_difference = rhs.m_difference;
+ return * this;
+ }
+ const void_caster & operator*(){
+ return *this;
}
// each derived class must re-implement these;
virtual void const * upcast(void const * const t) const = 0;
@@ -136,6 +145,11 @@
m_base(base),
m_difference(difference)
{}
+ void_caster(const void_caster & rhs) :
+ m_derived(rhs.m_derived),
+ m_base(rhs.m_base),
+ m_difference(rhs.m_difference)
+ {}
virtual ~void_caster(){}
};
@@ -210,8 +224,8 @@
template <class Derived, class Base>
void_caster_virtual_base<Derived,Base>::void_caster_virtual_base() :
void_caster(
- & type_info_implementation<Derived>::type::get_const_instance(),
- & type_info_implementation<Base>::type::get_const_instance()
+ & (type_info_implementation<Derived>::type::get_const_instance()),
+ & (type_info_implementation<Base>::type::get_const_instance())
)
{
recursive_register(true);
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