Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 18th, 2005, 09: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, 06: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

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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 network members.
Post your question now . . .
It's fast and it's free

Popular Articles