[openbeos] Re: Coding Suggestion -- Templates, Iterators
- From: "Daniel Reinhold" <danielr@xxxxxxxxxxxxx>
- To: openbeos@xxxxxxxxxxxxx
- Date: Sat, 27 Oct 2001 15:13:06 CDT
>Your loop macro doesn't work. (elem++)
>And anyway, it doesn't get rid of the iterator declaration.
>That is more effort than it is worth.
>
>-Max
works for me (gcc 2.9 on BeOS R5). pre-increment/post-increment doesn't
matter for a single statement, btw.
no, it doesn't get rid of the declaration (all variables have to be
declared), but it makes it simpler to read and understand (and easier
to type). also, it makes it easier to make changes: for example
typedef std::vector<Test *>::iterator TestIterator;
occurs exactly once. If you need to change the class type later, you
can do so at that one spot rather than having to do a global search&
replace for every instance of "std::vector<Test *>::iterator" in the
code.
Other related posts:
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators
- » [openbeos] Re: Coding Suggestion -- Templates, Iterators