Modify

Opened 5 years ago

Closed 4 years ago

#7232 closed Bugs (fixed)

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 (0)

Change History (5)

comment:1 Changed 5 years 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 5 years ago by igaztanaga

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

Fixed in trunk at revision: 80047

comment:3 Changed 5 years 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 5 years ago by igaztanaga

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:5 Changed 4 years ago by igaztanaga

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

It was fixed in Boost 1.52.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain igaztanaga.
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.