Opened 6 years ago

Closed 6 years ago

#6540 closed Bugs (fixed)

Erroneous default argument in basic_string::compare overload

Reported by: Erik Jensen <Erik.Jensen@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:


basic_string in string.hpp contains the following definition:

int compare(size_type pos1, size_type n1, const CharT* s, size_type n2 = npos) const {...}

However, n2 should not have a default argument. It interferes with calling "int compare(size_type pos1, size_type n1, const CharT* s) const", and a value of npos makes no sense for n2 anyway (it would mean the passed c string had "infinite" length).

Thank you, Erik Jensen

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

Thanks for the report, fixed in both release and trunk branches at revisions 76985 & 76986.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment

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

Note: See TracTickets for help on using tickets.