Vector function?

Hi,

I have some code, and I get an error while running it:

1
2
3
4
5
6
7
8
9
10
11
12
13
//GameVectorz.h
 #ifndef GAME_VECTORZ_H
#define GAME_VECTORZ_H
#include <vector>
#include "Startup.h"
class Vectorx{
public:
	void Vectorx::add_vectorz(vector<StartProfile> a, int player,
vector<StartProfile> b);
	vector<StartProfile::question> questions;
	vector<StartProfile> Players;
};
#endif 

1
2
3
4
5
6
//GameVectorz.cpp
#include "GameVectorz.h"

void Vectorx::add_vectorz(vector<StartProfile> a, int player, vector<StartProfile> b){
	a.push_back(b);
}


When I run, I get this error:
Line Location GameVectorz.cpp:13: error: no matching function for call to '__gnu_debug_def::vector<StartProfile, std::allocator<StartProfile> >::push_back(__gnu_debug_def::vector<StartProfile, std::allocator<StartProfile> >&)'

Please help!
What is the purpose of int player on line 4 also you can not push a vector into a vector. You must push a vector into a vector of vectors
1
2
3
std::vector<std::vector<StartProfile> > a( SIZE );
std::vector<StartProfile> b( SIZE );
a.push_back( b );


By the way that is not "Adding" the vectors that is just storing a vector inside of another vector(that holds vectors.)
If you want to add maybe overload the operator+
Topic archived. No new replies allowed.