The Filterator


 
Have you ever wanted to write your own C++ STL-style iterator? Of course you have. In some ways it’s easy, but getting all the boilerplate code correct can be a challenge. Fortunately, now there’s a great example that’s been put together by Ahmed Charles. He worked closely with some experts from the Microsoft Visual Studio team. You can find the end result here: http://blogs.msdn.com/b/vcblog/archive/2010/08/09/the-filterator.aspx
 
This iterator class performs a filter based upon a predicate you supply. The result is that you can iterate through just the items you care about in a given container.
Advertisements
This entry was posted in C++. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s