Re: [Boost-users] Serialization--a peculiar observation regarding operator<<
Robert, Oliver, and Dave: That seems to have fixed it. I'm embarrassed for not having figured it out. Thank you very much. Michael P.S. This is totally off-topic, but I'd be a lot *less* embarrassed if the VC compiler error messages were not so lame. This compiler has managed to annihilate huge segments of my life with messages of the form "Could not do the right thing with an X" instead of "Could not do the right thing with an X; a Y was expected." In this case it should have said "binary '<<': no operator found which takes a right-hand operand of type 'double' (or there is no acceptable conversion to 'const double')" Just that tiny rephrasing words would have saved a lot of pain. Alas. Anyway: Thanks again you guys. --MD
------------------------------
Message: 5 Date: Mon, 3 Apr 2006 08:55:30 -0700 From: "Robert Ramey"
Subject: Re: [Boost-users] Serialization--a peculiar observation regardingoperator<< To: boost-users@lists.boost.org Message-ID: hmm
The operator ar << takes a reference to a const argument.
It looks like the compiler is objecting to taking the reference to an argument on the stack
ar << foo();
which seems like a good idea to me. In this case there would be no problem, but in the case where the return of foo() would be a "tracked" type, this would break the serialization system.
Robert Ramey
Message: 1 Date: Mon, 3 Apr 2006 10:33:55 +0200 From: "David Klein"
Subject: Re: [Boost-users] Serialization--a peculiar observation regardingoperator<< To: Message-ID: Content-Type: text/plain; charset="us-ascii"
hi michael,
try changing:
double foo() { return 3.1416; }
to
const double foo() { return 3.1416; }
HTH dave
Message: 2 Date: Mon, 3 Apr 2006 10:39:28 +0200 From: "Oliver Mutz"
Subject: Re: [Boost-users] Serialization--a peculiar observation regardingoperator<< To: Message-ID: <001501c656fa$21bb3ed0$050aa8c0@int.isdcad.de> Content-Type: text/plain; charset="us-ascii" Try changing the return type of foo() to const double. For the reason see the ratinale page in the serialization documentation.
Oliver
participants (1)
-
Drumheller, Michael