Re: Why use STL?
- From: "Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@xxxxxxxxxxxxxxx>
- Date: Wed, 20 Apr 2005 15:41:53 -0700
Lisa Pearlson wrote:
>> STL, but the STL's most important libraries are the iterators and
>> algorithms, which MFC doesn't cover at all!
>
> Iterators? You mean nothing more than "start()" and "end()" and ++ ?
> I apologize for my ignorance, but can't you simply build a simple
> wrapper around CArray like this:
>
> class CMyArray<TX,TY> : CArray<TX,TY>, i(-1)
> {
> private:
> int i;
> ...
> void Start() { i = GetSize() - 1; }
> void End() { i = GetSize(); }
> int operator++ ... i++ // forgot the exact syntax, but you know what
> I mean ...
> }
>
>
> Of course this doesn't fix the inefficiencies of CArray
> implementation, but it's this easy to implement itterated access.
> Or am I completely misunderstanding what "iterators" are all about?
>
Iterators are easy.
It's the fact that STL container classes don't implement any algorithms (in
general - there are a few exceptions). Rather, there are stand-alone
algorithm implementations that work generically on iterators. They can
operate on the standard containers and on any other containers you'd care to
create.
-cd
.
- References:
- Why use STL?
- From: Lisa Pearlson
- Re: Why use STL?
- From: Lisa Pearlson
- Re: Why use STL?
- From: Tom Widmer
- Re: Why use STL?
- From: Lisa Pearlson
- Re: Why use STL?
- From: Tom Widmer
- Re: Why use STL?
- From: Lisa Pearlson
- Why use STL?
- Prev by Date: Re: Why use STL?
- Next by Date: Re: Why use STL?
- Previous by thread: Re: Why use STL?
- Next by thread: Re: Why use STL?
- Index(es):
Relevant Pages
|
Loading