Boost.Iterator runtime assertion with MSVC

Hello
The following piece of code :
____________________
#include<string>
#include<map>
#include<iostream>
#include<iterator>
#include

Hi Narinder,
On Thu, Jul 21, 2011 at 5:21 PM, Narinder Claire
Hello
The following piece of code : <snip code> executes fine when compiled with mingw(gcc 4.5.2) and gcc 4.5.2(Ubuntu 11.04) but crashes when compiled with VS2010 & VS2008. The issue seems to be something about not being allowed to dereference an iterator toa string. Can anyone shed any light on this ?
The problem is the result_type of the transformer struct -- it ensures
the returned string is copied, despite the return value of the
operator() call. For details on why the it_works example works, see
http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-....
The it_fails example is due to the string being copied, the iterator
being retrieved, and the copied string being destroyed (all on the
it_fails initialization line). It appears that changing your
transformer declaration as follows will work:
struct transformer
{
typedef const std::string& result_type;
result_type operator()(
const std::pair
participants (2)
-
Narinder Claire
-
Nathan Crookston