-
January 13th, 2004, 04:00 AM
#1
type checking
if i got an iterator
how can i sure that it is a random access iterator??
will it be a way for testing it??
thank for reply
regard
SAto
-
January 13th, 2004, 04:58 AM
#2
If I am not wrong, only iterators from std::vector and std::string are random access iterator.
-
January 13th, 2004, 07:01 AM
#3
You might write your own container with random-access iterators...
There is std::iterator_traits that can tell you the category of an iterator. This requires some extreme template programming, of course.
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
-- Sutter and Alexandrescu, C++ Coding Standards
Programs must be written for people to read, and only incidentally for machines to execute.
-- Harold Abelson and Gerald Jay Sussman
The cheapest, fastest and most reliable components of a computer system are those that aren't there.
-- Gordon Bell
-
January 13th, 2004, 07:02 AM
#4
Oh, and std:eque is, I believe, random access.
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
-- Sutter and Alexandrescu, C++ Coding Standards
Programs must be written for people to read, and only incidentally for machines to execute.
-- Harold Abelson and Gerald Jay Sussman
The cheapest, fastest and most reliable components of a computer system are those that aren't there.
-- Gordon Bell
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|