Search the web
Sign In
New User? Sign Up
steve_dewhurst · The Steve Dewhurst Mailing List
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
List grows up!   Message List  
Reply | Forward Message #58 of 62 |
A while back I published an article in the (late, much missed) CUJ
describing a List container that used two-way pointers to implement an
STL-like container with "fickle-forward" iterators. The primary goal
of that article was to illustrate the continued value of bitwise
operators in advanced C++ programming.

However, I've been thinking about List and its weird iterators on and
off since then. As an exercise for my advanced STL course, I decided
to turn List into a fully-compliant STL container. The results were
pleasing:

The new container is called "flist," which is pronounced "ef list."
The "f" stands for "fickle."

flist has the same functionality as std::list (splice, merge, sort,
remove_if, etc.)

flist uses half the working storage of std::list, with equivalent
performance. This implementation of flist also seems to cause less
code bloat than (at least some implementations of) std::list for many
instantiations with different element types.

flist has "fickle-bidirectional" iterators that can easily change
their mind about which way they're traversing. (It also has
reverse_iterators, but they have different properties.)

flist has a constant-time reverse operation.

The major functional difference between std::list and flist is in
iterator invalidation. flist is not a "node-based" container (even
though it's implemented with nodes) because inserting or erasing an
element may affect iterators to adjacent elements. However, like
std::deque, pointers and references to adjacent elements are unaffected.

The source code for flist may be found on Semantics Consulting's code
page: <http://www.semantics.org/code.html#flist>. Comments at the
head of the file give more information about the container, and I hope
to have documentation and usage examples available soon.

Steve








Mon Jun 19, 2006 12:50 pm

stephencdewh...
Offline Offline
Send Email Send Email

Forward
Message #58 of 62 |
Expand Messages Author Sort by Date

A while back I published an article in the (late, much missed) CUJ describing a List container that used two-way pointers to implement an STL-like container...
stephencdewhurst
stephencdewh...
Offline Send Email
Jun 19, 2006
12:53 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help