Connecting Tech Pros Worldwide Help | Site Map

define new iterators

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 18th, 2005, 08:25 PM
PengYu.UT@gmail.com
Guest
 
Posts: n/a
Default define new iterators

Hi,

I have to define a composite class. I'm wondering if there are any easy
way to define its corresponding iterator class. Can I inherent the
iterator from some library?

Best wishes,
Peng


  #2  
Old August 19th, 2005, 05:15 AM
Alipha
Guest
 
Posts: n/a
Default Re: define new iterators


PengYu.UT@gmail.com wrote:[color=blue]
> Hi,
>
> I have to define a composite class. I'm wondering if there are any easy
> way to define its corresponding iterator class. Can I inherent the
> iterator from some library?
>
> Best wishes,
> Peng[/color]

you should almost always inherit from std::iterator to have the
appropriate typedefs created for you and so that std::iterator_traits
will work for your class. but no functions are generated for you; you
have to write them yourself. however, boost (www.boost.org) has
iterator adapter and facet (sp?) classes, which (supposably) make it
easier to create iterators (once you understand how to use them).

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.