Opened 5 years ago

Closed 5 years ago

#6540 closed Bugs (fixed)

Erroneous default argument in basic_string::compare overload

Reported by: Erik Jensen <Erik.Jensen@…> Owned by: igaztanaga
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 5 years ago by igaztanaga

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

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

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain igaztanaga.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.