Opened 10 years ago

Closed 10 years ago

#7232 closed Bugs (fixed)

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

Reported by: kariya_mitsuru@… Owned by: Ion Gaztañaga
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.

Change History (5)

comment:1 by Ion Gaztañaga, 10 years ago

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 by Ion Gaztañaga, 10 years ago

Resolution: fixed
Status: newclosed

Fixed in trunk at revision: 80047

comment:3 by Mitsuru Kariya <kariya_mitsuru@…>, 10 years ago

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 by Ion Gaztañaga, 10 years ago

Resolution: fixed
Status: closedreopened

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

comment:5 by Ion Gaztañaga, 10 years ago

Resolution: fixed
Status: reopenedclosed

It was fixed in Boost 1.52.

Note: See TracTickets for help on using tickets.