
3 Feb
2009
3 Feb
'09
7:24 p.m.
On Tue, Feb 3, 2009 at 5:00 PM, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG
Stuart Dootson wrote:
Try changing the string_pair typedef to:
std::pair<std::string const, std::string> string_pair;
Not 100% sure *why* this makes it run rather than crash (with VC++ 2008, Boost 1.37.0), but it makes some sort of sense, as the key in a map is immutable.
The reason is that std::pairs can be converted to each other. If the type doesn't match exactly: 1) It will be implicitly converted to the correct type. 2) Then you get a reference to first. 3) Then the temporary created in step 1 is destroyed 4) Then you stream first (which has just been destroyed)
In Christ, Steven Watanabe
Thanks Steven - it's always good to get some educashun! :-) Stuart D