Modify

Ticket #7232 (closed Bugs: fixed)

Opened 21 months ago

Last modified 16 months ago

boost::container::basic_string::insert's implementation is inconsistent with a document

Reported by: kariya_mitsuru@… Owned by: igaztanaga
Milestone: To Be Determined Component: container
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:

Description

In boost::container::basic_string::insert, the function prototype is

  void insert(const_iterator p, size_type n, CharT c);

but the document has a return value description

Returns: An iterator which refers to the copy of the first inserted character, or p if n == 0.

Also

  template<typename InputIter> 
    void insert(const_iterator p, InputIter first, InputIter last);

and

Returns: An iterator which refers to the copy of the first inserted character, or p if first == last.

I think these functions should return an iterator written in the document, like c++11.

Attachments

Change History

comment:1 Changed 21 months ago by igaztanaga

Thanks for the report. In the standard these functions return void:

 http://www.cplusplus.com/reference/string/string/insert/

So documentation should be corrected.

comment:2 Changed 21 months ago by igaztanaga

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in trunk at revision: 80047

comment:3 Changed 21 months ago by Mitsuru Kariya <kariya_mitsuru@…>

Thanks for your reply.

Until C++03 standard, these functions return void. But from C++11 standard, these functions were revised.

 http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#149

I think that basic_string (and other container in Boost.Container) would be better off returning an iterator for "C++11 Conformance".

comment:4 Changed 21 months ago by igaztanaga

  • Status changed from closed to reopened
  • Resolution fixed deleted

Thanks again, I see the change in N3776 from the pre-standard draft N3337. Reopened for future fix.

comment:5 Changed 16 months ago by igaztanaga

  • Status changed from reopened to closed
  • Resolution set to fixed

It was fixed in Boost 1.52.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.