@@ -39,6 +39,7 @@ template <class T, class D> class Problem {
3939 // Running the stack
4040 void run ();
4141 void run (int limit);
42+ void readPush (int iter = 1 );
4243 void push (Data<T, D> elt);
4344 Data<T, D> pop ();
4445 Data<T, D> top (int k);
@@ -227,7 +228,7 @@ template <class T, class D> void Problem<T, D>::readPush(int iter) {
227228
228229
229230/* ==============================================================================
230- Stack Functions: run, push, pop, top
231+ Stack Functions: run, push, pop, top, readPush
231232==============================================================================*/
232233template <class T , class D > void Problem<T, D>::run() {
233234 initStackIntern ();
@@ -275,6 +276,19 @@ template <class T, class D> void Problem<T, D>::run(int limit) {
275276 }
276277}
277278
279+ template <class T , class D > void Problem<T, D>::readPush(int iter) {
280+ for (int i = 0 ; i < iter; i++) {
281+ std::streampos position = mInput .tellg ();
282+ (*mStack ).setPosition (position);
283+ std::vector<std::string> line = readLine ();
284+ D data = readInput (line);
285+ mIndex ++;
286+ Data<T, D> elt (mIndex , data);
287+ pushAction (elt);
288+ push (elt);
289+ }
290+ }
291+
278292template <class T , class D > void Problem<T, D>::push(Data<T, D> elt) {
279293 std::cout << " goinbg to push " <<elt.getData () << std::endl;
280294
0 commit comments