Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Shared Memory Compilation Issue
From: TONGARI (tongari95_at_[hidden])
Date: 2011-07-22 12:58:59


2011/7/22 Nathan Lewis <nathanlewissubscription_at_[hidden]>

> TONGARI <tongari95 <at> gmail.com> writes:
>
> >
> >
> > 2011/7/22 Nathan Lewis <nathanlewissubscription <at> gmail.com>
> >
> > char_string_vector_iterator it =
> mymap->char_string_vector_vector_.begin();
> > while (it != mymap->char_string_vector_vector_.end())
> > {
> > // error is on the line below
> cout << "Inserted String is: " << it << endl;
> >
> >
> >
> > cout << "Inserted String is: " << *it << endl; You need the dereference
> not
> the iterator itself.HTH
> >
> >
> >
> >
> > _______________________________________________
> > Boost-users mailing list
> > Boost-users <at> lists.boost.org
> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
> If I want to create a new local string out of what was put in shared
> memory?
> Thoughts?
>
> while (it != mymap->char_string_vector_vector_.end())
> {
> string myNewString(*it); // doesn't compile
> string myNewString(*it.c_str()); // apparently no equivalent
> cout << "Inserted String is: " << *it << endl;
> it++;
> }
>

string myNewString(it->begin(), it->end());
//or
string myNewString(it->c_str());

HTH



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