Archived

This topic is now archived and is closed to further replies.

Mithrandir

Adapting functions

Recommended Posts

Mithrandir    607
I''m having a real dilly of a time trying to figure a problem out. I''ve got many STL-type algorithms of my own design, and I would like to use the algorithms on both collections of a datatype, and collections of pointers of that datatype. Needless to say, I''d really love to not duplicate my code, so is there a simple way to do such a thing?

Share this post


Link to post
Share on other sites
Mithrandir    607
I can''t say for sure, but it appears that I have found a solution:


overload operator() in all of my functors to accept pointers. This unfortunately has a side effect of requiring all iterators used to be able to be coerced into pointer objects, but that actually doesn''t seem to be a problem at the moment.

Share this post


Link to post
Share on other sites