I'm stumped as to why my template typedef simulation doesn't work with
serialization.
Here's a simple example:
template<typename T>
struct A {
};
template<typename T>
struct B {
typedef A<T> type;
};
namespace boost { namespace serialization {
template
On Sep 17, 2007, at 12:45 AM, Neal Becker wrote:
I'm stumped as to why my template typedef simulation doesn't work with serialization.
Here's a simple example:
template<typename T> struct A { };
template<typename T> struct B { typedef A<T> type; };
namespace boost { namespace serialization { template
inline void serialize (Archive &ar, typename B<T>::type & v, const unsigned int file_version) { <<< This won't work //inline void serialize (Archive &ar, A<T> & v, const unsigned int file_version) { <<< This is OK boost::serialization::split_free (ar, v, file_version); } } } I expected typename B<T>::type is equivalent to A<T>, but gcc-4.1.2 doesn't agree. The latter compiles, but the 1st gives: /usr/local/src/boost.hg/boost/serialization/access.hpp:109: error: ‘struct A<int>’ has no member named ‘serialize’
This is probably because the default serialize() template which forwards to a member function is a better match than your version. Matthias
participants (2)
-
Matthias Troyer
-
Neal Becker