For the exercise 2, question 1, you had to write an array-based stack. While keeping the same public interface, please rewrite this Stack class using a double-linked list instead of the array. Use std::list<int> from the standard library as an implementation of a linked list.
The following functions from list<T> will be useful:
Your goal will be to write a template my_find() function taking as input an iterator pointing to the beginning of a container, an iterator pointing to the end of a container and an element 'e' and returning an iterator to the first found element in the container equal to 'e' or an iterator to the end of the container if no elements were found.
Please create a file "utils.h". Write your function template function find() in this file.
#include "utils.h"
#include <list>
#include <iostream>
int main()
{
std::list<int> l;
l.push_back(1); l.push_back(2);
l.push_back(5); l.push_back(1);
l.push_back(2);
std::list<int>::iterator it;
it = my_find(l.begin(), l.end(), 2);
if (it != l.end()) std::cout << "found " << *it << std::endl;
}