Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2004-04-26 12:31:08


Jeff F wrote:

> template<class Archive>
> inline void serialize(
> Archive& ar
> , boost::filesystem::path& t
> , unsigned int version )
> {
> std::string lPathString;
>
> if( is_saving(ar) )
> lPathString = t.native_file_string();
>
> ar & make_nvp( "PathString", lPathString );
>
> if( is_loading(ar) )
> t = boost::filesystem::path( lPathString,
> boost::filesystem::native );
> }

The "real" solution here is to implement serialization for
"native_file_string()

So that things look like

template<class Archive>
void serialize(
        Archive &ar,
        boost::filesystem::native_files_sting_type & t,
        unsigned int version
){
        ... ?;
}

template<class Archive>
void serialize(
        Archive &ar,
        boost::filesystem::path & t,
        unsigned int version
){
        ar & make_nvp("PathString", t);
}

Robert Ramey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk