Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] compile-time detection of whether serialization is implemented for a class
From: Robert Ramey (ramey_at_[hidden])
Date: 2012-02-16 17:15:50


I would look into something like:

#include <boost/serialization/level.hpp>

my_type x;

if(boost::serialization::implementation_level<my_type>,
boost::serialization::level_type::not_serializable){
    ...
}

or some variation of there of such as:

#include <boost/serialization/level.hpp>

namespace boost {
namespace serialization {

template<class T>
struct is_serializable {
    typedef typename
        boost::mpl::greater_than<
            boost::serialization::implementation_level<my_type>,
            boost::serialization::level_type::not_serializable
>::type
    type;
};

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net