|
Serialization
|
dynamic_cast<T>(U * u)
for casting a pointer at runtime between two related types. However, this can only be
used for polymorphic classes. That is, it can only be used with related classes which have at least one virtual function.
Limiting the serialization of pointers to only such classes would diminish the applicability
of the library.
boost::serialization
.
template<class Derived, class Base>
const void_cast_detail::void_caster &
void_cast_register(
Derived const * derived = NULL,
Base * const base = NULL
);
Derived
is immediately derived from
Base
in a global table.
void_cast_register<A, B>();
void_cast_register<B, C>();
automatically derives the fact that A can be upcast to C and vice-versa.
void *
void_upcast(
extended_type_info const & derived_type,
extended_type_info const & base_type,
void * const t
);
void *
void_downcast(
extended_type_info const & derived_type,
extended_type_info const & base_type,
void * const t
);
extended_type_info
records. An attempt to cast between types not "registered" with
void_cast_register
will throw a
boost::archive::archive_exception
with value equal to
unregistered_cast
© Copyright Robert Ramey 2002-2004. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)