hi,
I am trying to write a function that gets an outputstream, a schedule(which is just a list pointers to items), and a function.
this function should be performed on each item in the schedule, and if it returns true it should print out the item.
when I try to compile with this code it give me the following errors:Code:std::ostream& printfilteredschedule(std::ostream& os, const Schedule& s, bool condition(const ScheduleItem*)) { for (Schedule::const_iterator i = s.begin(); i != s.end(); ++i) if (condition(*i)) (*i)->print(os); return os; } // somewhere else in code bool filteralarm(const FancyScheduleItem* si) { ulint t(time(0)); return (si->getbegin() >= t && std::min(si->getbegin() - (60 * si->getalarm()), (ulint)0) <= t); } // again somewhere else in the code else if (showtype == "ALARM") { printfilteredschedule(std::cout, s, filteralarm); }
58 D:\school\struII\taak3\processcommands.cc [Warning] the address of `bool filteralarm(const FancyScheduleItem*)', will always evaluate as `true'
[Linker error] undefined reference to `printfilteredschedule(std:stream&, Schedule const&, bool)'
I hope somebody can explain me what I am doing wrong.
thanks a lot