Finding errors in class template

Hello,

I have to find at least 5 errors in the following class template. I have found three and it now compiles, here is the template

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <map>
#include <utility> 

template <class T> class foo{
	public :
		foo(T bar1, T bar2){
		_bar1.push_back(bar1);
		_bar2.insert( std::pair<T,T>(bar1,bar2) );
		}
		
		~foo(){}
		
		void pushbackBar1(T bar1){
			_bar1.push_back(bar1);
		}

		void insertBar2(T bar2){
			_bar2.insert(bar2);
		}
		
	private :
		std::vector<T> _bar1;
		std::map<T> _bar2;
};

int main(){
	double bar1=1.0;
	foo<double> bar;
	bar.pushbackBar1(bar1);
}


The errors I believe I have found are as follows: the vector library has not been added, the map requires two type arguments rather than one and the object which is created in main doesn't pass any values to the constructor. I fixed all of these errors and the code now compiles without errors, however the problem asks for five. Can anyone suggest what I may be missing?

Thanks
I think you should look at the function that is not called from main to find more errors.
Topic archived. No new replies allowed.