Reputation: 700
I have class T defined and implemented with a default constructor, a copy constructor and an assignment operator overloaded
I have tried to do the following
#include <vector>
//template <class Board>
typedef std::vector<Board> t_bvector;
with and without the comment, I am getting this error
../Piece.H:143:1: error: ‘t_bvector’ does not name a type
In file included from ../Board.C:1:0:
../Board.H:14:1: error: template declaration of ‘typedef’
In file included from ../Board.C:1:0:
I dont have C++11, and want to retain basic vector methods like .insert, .size is there a way to solve it? or a better suggestion for an STL container ?
Upvotes: 2
Views: 20360
Reputation: 71
Don't forget declare the custom typedef
statement after using namespace std;
to prevent a similar error
Upvotes: 0
Reputation: 8171
I'm not sure what you're trying to do with that template <class Board>
part but I'm guessing you've got some syntax wrong in your actual code or something misplaced.
Here is an example of how you should be trying to setup such a typedef.
#include <vector>
class Board
{
public:
int foo;
};
typedef std::vector<Board> t_bvector;
EDIT
Now that you've explained a bit more:
class Board;
typedef std::vector<Board> t_bvector;
class Board
{
public:
t_bvector SomeFunction();
};
Upvotes: 3