std::string &GetName() const;
const int GetThreshold() const;
typedef vector<A *> APtrContainer;
Graphic &GetGraphic() const;
Still, my desire to use std::for_each was strong, pah! to for-loops I thought, there must be a way!
I thought back to how the old, ugly code would have looked, something like this I guessed...
Graphic &graphic = GetGraphic();
for(APtrContainer::iterator it = m_APCollection.begin(); it!=
std::string &name = it->GetName();
Control *control = GetControlByName(name);
// can return NULL
bool value =
control->GetCurrentValue() > it->GetThreshold();
So, now to refactor using std::for_each, I thought. I know I need to pass it a function object so let’s write that first. Perhaps I was being rash but fools rush in where angels fear to tread, so in I rushed …
Witness the resulting mess in part II coming soon...