Boost logo

Boost Users :

From: Piyush Kapadia (piyush.kapadia_at_[hidden])
Date: 2005-10-23 06:00:19


So instead of oa << BOOST_SERIALIZATION_NVP(T);

 

can we use following to have type name printed in xml file ?

oa << boost::serialization::make_nvp(typeid(T).name(), T);

 

 

  _____

From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Robert Ramey
Sent: Saturday, October 22, 2005 8:40 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] How to select the name of class definitioninstead
ofvariable name in XML archive

 

People have asked this before, its really needed, but as far as anyone
knows, there is no portable way to do this. Depending on your needs
type_id might return a string you can use.

 

Robert Ramey

"Piyush Kapadia" <piyush.kapadia_at_[hidden]> wrote in message
news:435aa424.08d6201b.180b.68ff_at_mx.gmail.com...

In following code - archive results in tag name as T as T is used in
BOOST_SERIALIZATION_NVP(T) statement.

Instead I want actual type name for T, instead of just T as Tag name, how to
achieve this ???

 

 

template<class T>

void Serialize(const char * filename)

{

            std::ofstream ofs(filename);

            assert(ofs.good());

            boost::archive::xml_oarchive oa(ofs);

            oa << BOOST_SERIALIZATION_NVP(T);

            ofs.close();

}

 

  _____

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users



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