Search:

Type: Posts; User: whiteflags

Search: Search took 0.13 seconds.

  1. Replies
    9
    Views
    4,073

    begin() -> s[0] = 'h'; s[1] = 'e'; s[2] =...

    begin() -> s[0] = 'h';
    s[1] = 'e';
    s[2] = 'l';
    s[3] = 'l';
    s[4] = 'o';
    s[5] = ?? <- end()

    std::distance() makes this irrelevant, but index number 4 is the 5th character, because indexes...
  2. Replies
    9
    Views
    4,073

    A pointer is an iterator type, so &string[pos] is...

    A pointer is an iterator type, so &string[pos] is an expression that will get you an iterator, but not necessarily a std::string::iterator. For that instead, write:
    string.begin() + pos
Results 1 to 2 of 2