![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Find, for a vector (as I showed above) returns an iterator. I did similarly to you: I located the index of the value that mached the value returned by the Find iterator. String::find returns a position, which is what you were looking for, but sometimes one has to make do or locate some appropriate new thangy.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#12 | |
|
Expert Programmer
Join Date: Jun 2005
Posts: 850
Rep Power: 4
![]() |
Note:
Quote:
|
|
|
|
|
|
|
#13 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,221
Rep Power: 5
![]() |
If a and b are random access iterators, b-a is related to the number of elements between them. Not all containers support random access iterators, but some (eg std::vector) do. A pointer to elements in a contiguous array is a particular type of random access iterator......
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|