   Design suggestions for scheduler
  Hello all!  I am in the process of re-designing some libraries I wrote a while back as a pet-project.  I want to update the mostly "C-style" code to safer, more extensible "C++ style" code.  Anyway, now I'm trying to tackle a basic scheduler module.The idea is simple:  the scheduler (lets call it class Scheduler) iterates over a list of Entity <smart>pointers, calling Entity->DoSomething() each time.  DoSomething() returns a value (a "cost") representing how long the action took (conceptually in game time, not actual time).  Entities such as characters, an input handler, a game clock, spell timers, etc. can be added to Schedule, and the game loop basically becomes:Scheduler.AddEntities();do{   Scheduler.Run();} while !GameState.quitThe whole purpose of this was written for a turn-based game, although I don't see why it couldn't be used in a real-time scenario.The possible problem as I see it, is that this is intrusive.  That is, any object that wants to be part of the scheduler must inherit Entity interface.  Basically, I don't want to lock myself into a design consideration that I might regret later.One alternative I considered was to just pass a member function pointer to the Scheduler, but that seems dangerous to me:  if the Entity has been destructed without removing it from Scheduler, bad things would undoubtedly ensue.So:  anyone have any other/better suggestions on doing something like this?  I feel like I may be missing something fundamental here, due to my inexperience.  Of course, using Entity inheritance may be the perfect solution, and maybe I just need some reassurance [embarrass]Thanks for any advice (and sorry if I was too long-winded!)   