Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Keep track of iterator progress

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Keep track of iterator progress
SiegeLord
Member #7,827
October 2006
avatar

A role is some behavior you want, some action you want to do. Basically you can compose your object out of distinct singular roles.

So... multiple inheritance? Even syntax is the same...

axilmar said:

Yes, and the implementation of those methods could call the relevant <algorithm> functions.

What if you wanted to make a new <algorithm>-like function yourself? How would you use your function on the built-in containers? I fail to see how your approach is more extensible than even the broken iterators of C++.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

axilmar
Member #1,204
April 2001

SiegeLord said:

What if you wanted to make a new <algorithm>-like function yourself? How would you use your function on the built-in containers? I fail to see how your approach is more extensible than even the broken iterators of C++.

It depends. If I was using the new algorithm for an application, then I would do a stand-alone function. If I was making a library that extends the stl, I would do a standalone function and then subclasses of stl containers with methods that call the new standalone function.

Thomas Fjellstrom
Member #476
June 2000
avatar

SiegeLord said:

So... multiple inheritance? Even syntax is the same...

Not quite, I suppose its more of a "mixin" than MI if you know what that is. It doesn't have the same problems MI has at least.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Bob
Free Market Evangelist
September 2000
avatar

Create your own thread if you want to bash and/or praise C++.

--
- Bob
[ -- All my signature links are 404 -- ]

anonymous
Member #8025
November 2006

But what exactly would be the benefit of doing:

class mycontainer does sortable does findable does foreachable does copyable does ... 200 more roles?

???

May-be an example? What would sortable look like, and what would it mean to the single linked list container I'd implement?

axilmar
Member #1,204
April 2001

The only thing the 'does' syntax reminds me of is 'Debby does...' ;-)

 1   2 


Go to: