Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Wypisz
- {
- public:
- void operator()(int) const;
- };
- void Wypisz::operator()(int liczba) const
- {
- cout << liczba << "\n";
- }
- template <class T, class UnaryFunction>
- void forEach(List<T> const & l, UnaryFunction f)
- {
- typename List<T>::wezel * pom = l.Poczatek();
- while (pom)
- {
- f(pom->element);
- pom = pom->nast;
- }
- }
- int main()
- {
- List<int> lst;
- Wypisz f;
- forEach(lst, f);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement