@@ -69,7 +69,7 @@ Problem<T,D>::Problem(std::string fileName, int size)
6969 mInput .open (fileName, std::ifstream::in);
7070 mOutput = nullptr ;
7171
72- mContext = nullptr ;
72+ mContext = new T () ;
7373 mIndex = 0 ;
7474
7575 mStack = new NormalStack<T> (size);
@@ -117,13 +117,10 @@ std::vector<std::string> Problem<T,D>::readLine()
117117 std::vector<std::string> line;
118118 size_t pos=std::string::npos;
119119 getline (mInput ,str);
120- std::cout << " Debug 4 : " << str << std::endl;
121120 while (true ){
122121 pos=str.find_first_of (" ," );
123122 line.push_back (str.substr (0 ,pos));
124- std::cout << " Debug 4.2 : " << str << " and pos = " << pos << std::endl;
125123 str.erase (0 ,pos+1 );
126- std::cout << " Debug 4.1 : " << str << " and pos = " << pos << std::endl;
127124 if (pos=std::string::npos){
128125 line.push_back (str.substr (0 ,pos));
129126 str.erase (0 ,pos);
@@ -139,13 +136,10 @@ template <class T, class D>
139136void Problem<T,D>::run() {
140137 initStack ();
141138 while ((mInput .good ())) {
142- std::cout << " Debug 1" << std::endl;
143139 std::vector<std::string> line = readLine ();
144140 if ( (line.front ()== " -1" ) || (line.front ()==" " ) ) {
145141 break ;
146142 }
147- std::cout << " Debug 2 : size = " << line.size () << std::endl;
148- std::cout << " Context = " << (line.back ()) << std::endl;
149143 D data = readInput (line);
150144 mIndex ++; // Might have to move
151145 while ( (emptystack ()) && (popCondition (data)) ) {
@@ -156,7 +150,6 @@ void Problem<T,D>::run() {
156150 Data<D> elt (mIndex ,data);
157151 pushAction (elt);
158152 push (elt);
159- println ();
160153 }
161154 }
162155}
@@ -189,10 +182,10 @@ void Problem<T,D>::setOutput(std::string fileName){
189182
190183template <class T , class D >
191184void Problem<T,D>::setContext(T context){
192- std::cout << " setContext, T = " << context << std::endl;
193- mContext = & context;
194- std::cout << " setContext, *mContext = " << (*mContext ) << std::endl;
195- std::cout << " setContext, *mContext = " << getContext () << std::endl;
185+ // std::cout << "setContext, T = " << context << std::endl;
186+ * mContext = context;
187+ // std::cout << "setContext, *mContext = " << (*mContext) << std::endl;
188+ // std::cout << "setContext, *mContext = " << getContext() << std::endl;
196189}
197190
198191/* * Getters **/
0 commit comments