Different behavior of boost::serialization of strings on text archive

Hi all,
I'm having some issue serializing a `std::string` with
`boost::serialization` on a `text_oarchive`. AFAICT, I have two identical
pieces of code that behaves differently in two different programs.
This is the program that I believe is behaving correctly:
#include <iostream>
#include <string>
#include <sstream>
#include

On 07/03/2013 12:25 PM, Andrea Ranieri wrote:
connection_.async_write("abcd", boost::bind(&client::handle_write, this, boost::asio::placeholders::error));
What happens if you pass std::string("abcd") as the first argument instead the "abcd" literal?

Bjorn Reese wrote
On 07/03/2013 12:25 PM, Andrea Ranieri wrote:
connection_.async_write("abcd", boost::bind(&client::handle_write, this, boost::asio::placeholders::error));
What happens if you pass std::string("abcd") as the first argument instead the "abcd" literal?
Thanks to everybody for the answers, and sorry for my late reply. Yes, this was indeed the problem: the compiler had no reason to convert "abcd" to std::string, so I was passing a const char *, that is serialized in a different way. Jeff Flinn-2 wrote
Are you missing:
#include <boost/serialization/string.hpp>
in your actual code?
I tested this one as well, with no luck. It seems that boost/serialization/string.hpp is almost entirely commented out by `#if 0` blocks in boost 1.53. There should be no need for this include anymore. Thank you again and best regards Avio -- View this message in context: http://boost.2283326.n4.nabble.com/Different-behavior-of-boost-serialization... Sent from the Boost - Users mailing list archive at Nabble.com.

On 7/3/2013 6:25 AM, Andrea Ranieri wrote:
Hi all,
I'm having some issue serializing a `std::string` with `boost::serialization` on a `text_oarchive`. AFAICT, I have two identical pieces of code that behaves differently in two different programs.
This is the program that I believe is behaving correctly:
#include <iostream> #include <string> #include <sstream>
#include
#include template <typename T> void serialize_deserialize(const T & src, T & dst) {
Are you missing:
#include

Andrea Ranieri wrote:
Hi all,
I'm having some issue serializing a `std::string` with `boost::serialization` on a `text_oarchive`. AFAICT, I have two identical pieces of code that behaves differently in two different programs.
This is the program that I believe is behaving correctly:
#include <iostream> #include <string> #include <sstream>
...
try using
#include
participants (5)
-
Andrea Ranieri
-
Avio
-
Bjorn Reese
-
Jeff Flinn
-
Robert Ramey