Joe Laughlin wrote:[color=blue]
> Mike Wahler wrote:[color=green]
>> "Joe Laughlin" <Joseph.V.Laugh lin@boeing.com> wrote in
>> message news:I60Dvs.FqL @news.boeing.co m...[/color][/color]
<snip>[color=blue][color=green][color=darkred]
>>> Joe Laughlin wrote:
>>> std::back_inser t_iterator<std: :string>::opera tor=(const
>>> std::back_inser t_iterator<std: :string>&)[/color]
>>
>> 'back_insert_it erator' requires that the container type
>> specified by its template argument defines members
>> 'push_back()' and 'value_type'. 'std::string' defines the
>> latter, but not the former.
>>
>> IOW you cannot use 'back_insert_it erator' with a
>> 'std::string'. ('std::string', while sharing much
>> commonality with them, isn't strictly a 'container').
>>
>> -Mike[/color]
>
> Argh.
>
> From "Accelerate d C++", pg 121:
>
> "back_inserter( c)
> Yields an iterator on the container c that appends
> elements to c. The container must support push_back,
> which the list, vector, and the string types all do."[/color]
Was the book wrong? Or am I reading it wrong?
> Mike Wahler wrote:[color=green]
>> "Joe Laughlin" <Joseph.V.Laugh lin@boeing.com> wrote in
>> message news:I60Dvs.FqL @news.boeing.co m...[/color][/color]
<snip>[color=blue][color=green][color=darkred]
>>> Joe Laughlin wrote:
>>> std::back_inser t_iterator<std: :string>::opera tor=(const
>>> std::back_inser t_iterator<std: :string>&)[/color]
>>
>> 'back_insert_it erator' requires that the container type
>> specified by its template argument defines members
>> 'push_back()' and 'value_type'. 'std::string' defines the
>> latter, but not the former.
>>
>> IOW you cannot use 'back_insert_it erator' with a
>> 'std::string'. ('std::string', while sharing much
>> commonality with them, isn't strictly a 'container').
>>
>> -Mike[/color]
>
> Argh.
>
> From "Accelerate d C++", pg 121:
>
> "back_inserter( c)
> Yields an iterator on the container c that appends
> elements to c. The container must support push_back,
> which the list, vector, and the string types all do."[/color]
Was the book wrong? Or am I reading it wrong?
Comment