basic_string::npos

From: Gene Wirchenko (gwirchenkoEXCEPT_at_CAPITALSwencomine.com)
Date: 10/30/03


Date: Thu, 30 Oct 2003 21:48:27 GMT


     In the documentation that is a cruel joke department, we have:

     Supposedly string.find() returns basic_string::npos if the search
string is not found. What is this value? The docs I have state:

"basic_string::max_size
size_type max_size() const;
The member function returns the length of the longest sequence that
the object can control.

basic_string::npos
static const size_type npos = -1;
The constant is the largest representable value of type size_type. It
is assuredly larger than max_size(), hence it serves as either a very
large value or as a special code."

  1) -1 is assuredly larger than the length of the longest sequence
that a string can control?

  2) Despite
          #include <string>
I am not able to refer to this value anyway.

     What is the correct data, please?

Sincerely,

Gene Wirchenko



Relevant Pages

  • Having trouble with multi-select list box in Access
    ... Const mstrcRange_Begin As String ... name of a control that represents the End part of a range ... On Error GoTo ErrHandler ...
    (microsoft.public.access.gettingstarted)
  • Re: Update sheetname from cell, automatically
    ... Const sERROR As String = "Invalid worksheet name in cell " ... Dim sSheetName As String ... Set mySheet = Sheet2 ... ElseIf Not ) Is ...
    (microsoft.public.excel.programming)
  • RE: Get Open File Name dialog. When user clicks cancel.
    ... strCustomFilter As String ... Const ahtOFN_OVERWRITEPROMPT = &H2 ... Optional varTitleForDialog As Variant) As Variant ... Dim strFilter As String ...
    (microsoft.public.office.developer.vba)
  • RE: API Open Dialog. What if user cancels
    ... strCustomFilter As String ... Const ahtOFN_OVERWRITEPROMPT = &H2 ... Optional varTitleForDialog As Variant) As Variant ... Dim strFilter As String ...
    (microsoft.public.access.formscoding)
  • API Open Dialog. What if user cancels
    ... strCustomFilter As String ... Const ahtOFN_OVERWRITEPROMPT = &H2 ... Optional varTitleForDialog As Variant) As Variant ... Dim strFilter As String ...
    (microsoft.public.access.formscoding)