By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,925 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,925 IT Pros & Developers. It's quick & easy.

typedef error, #define instead?

P: n/a
The following code throws a compiler error: expected init-declarator
before '<' token
struct mystru
{
int yspace;
std::string ymonkey;
};

typedef std::vector<mystru> myvec;

I think I should use the following instead but what is the usual way to
avoid myvec being picked up somewhere else?

#define myvec std::vector<mystru>
Thanks,
Daniel

Aug 4 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

sa************@hotmail.com schreef:
The following code throws a compiler error: expected init-declarator
before '<' token
struct mystru
{
int yspace;
std::string ymonkey;
};

typedef std::vector<mystru> myvec;


The compiler has to know std::vector is a template, else it won't know
that < starts the template argument list. Include <vector>.

HTH,
Michiel Salters

Aug 4 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.