Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    195
  • comments
    198
  • views
    104193

programmer needs sleep

Sign in to follow this  
SiCrane

154 views

I've been trying to clean up my code to my transform iterator adaptors to get up the quality to put in my code library. The theory is similar to boost::transform_iterator, except unlike boost::transform_iterator, my iterator class doesn't lie. boost::transform_iterator will often make claims via type traits about being a bidirectional or random access iterator even though it doesn't actually satisfy the requirements necessary to support the claim. This has caused some of my code to blow up unhappily before. This is something I can forgive since part of boost's goals is to point out deficiencies in the existing standard, like the iterator requirements, but it's still not something I feel comfortable using.

Instead of a boost's schizophrenic single transform iterator class that tries to be both an input and an output iterator at the same time depending on the template parameters, I have two transform iterator classes, one a input iterator and one an output iterator. This simplifies compiles (one of the goals for my code library) as well as making the output iterator behave more like I expect it to (compared to boost::transform_iterator).

There's also a schizophrenic single transform iterator class I might add that does many of the things I complain about with boost::transform_iterator, except I label mine with a big Unsafe in the class name, to remind myself that it lies when it claims to be a random access iterator. Oh, and it's behaviour when used as a output iterator also seems to be happier than boost's version. (Not happy, but happier.)

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!