Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

const ref constructor parameter

Status
Not open for further replies.

amie8202

Programmer
Aug 16, 2004
4
US
I have Xform class which are all implemented in the Xform.h, and the following is the constructor declarations.

Xform(const Tiny_vec<T,3>& angles,
const Tiny_vec<T,3>& trans);

Xform(const Tiny_mat<T,3,3>& rot,
const Tiny_vec<T,3>& trans);


Xform(const string& filename, Format format = FIXED_ANGLE)
throw(io_error, parse_error);

But if I compile, I get these kinds of errors:
error C2062: type 'const int' unexpected
error C2238: unexpected token(s) preceding ';'
error C2226: syntax error : unexpected type 'std::string'
*Tiny_vec is a template class of template<class T, int D>*

If I get rid of const ref of the Tiny_vec and Tiny_mat parameters, and pass non-const by value, then it doesn't complain but still gives error for string.
If I get pass by non-const value for the string, it still gives some kind of syntax error. Is there anything special about parameters going into the constructors? Because I have same kinds of parameter in the other member functions in Xform, but does not give any errors.

If anyone can answer this, I will be greatly appreciated!!
btw, I use VC++ .net (2003)

Thankx!
 
this may be a stupid question, but do you have "stdafx.h" included in your project?

bdiamond
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top