4 Replies - 327 Views - Last Post: 10 January 2013 - 01:14 AM Rate Topic: -----

#1 Arcand  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 08-January 13

error creating a vector in visual c++ 2010

Posted 09 January 2013 - 07:02 PM

just as the name says,

class ROOM : public OBJECT_ID
{
public:
	ROOM() : OBJECT_ID(OT_ROOM)
	{
		// ERROR CODE
	}
	ROOM(bool enter) : OBJECT_ID(OT_ROOM)
	{
		if (enter == true) in_room = true;
		if (enter == false) in_room = false;
	}
	ROOM(int size) : OBJECT_ID(OT_ROOM)
	{
		
	}
	~ROOM();
private:
	bool in_room;
	vector<int> room_size;
}



its a snippet but it shows what im asking, at the bottom vector<int> room_size gives me an error, saying its "not a template" and im not even sure what that means. I tried to "bite the bullet" and use a std:: prefix on it but that didnt work either. suggestions?

Is This A Good Question/Topic? 0
  • +

Replies To: error creating a vector in visual c++ 2010

#2 Arcand  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 08-January 13

Re: error creating a vector in visual c++ 2010

Posted 09 January 2013 - 07:44 PM

solved
Was This Post Helpful? 0
  • +
  • -

#3 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1091
  • View blog
  • Posts: 4,571
  • Joined: 09-June 09

Re: error creating a vector in visual c++ 2010

Posted 09 January 2013 - 08:03 PM

Aside from your question, do you see the redundancy in this code

if (enter == true) in_room = true;
if (enter == false) in_room = false;



Do you see that this code is equivalent to
in_room = enter;


Was This Post Helpful? 1
  • +
  • -

#4 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3628
  • View blog
  • Posts: 11,320
  • Joined: 05-May 12

Re: error creating a vector in visual c++ 2010

Posted 09 January 2013 - 09:46 PM

A side note: That is a horrible naming style to use all capitals for your class names. As a carry over from C, C++ naming style tends to also only use all capitals for constants and macros.
Was This Post Helpful? 1
  • +
  • -

#5 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1622
  • View blog
  • Posts: 5,709
  • Joined: 03-August 09

Re: error creating a vector in visual c++ 2010

Posted 10 January 2013 - 01:14 AM

ya, at first I had no clue what I was looking at. I thought macros were somehow involved until I looked closer.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1