Okay, here's the deal. I haven't tried to compile my code yet, because it's just a class library that I'm creating so far - nothing needed to be ran. Anyways, here's my code:

const std::vector<Item*>& Inventory::setItems(const Item* itms, crUINT numOfItms)
{
	_itms.clear();
	for (UINT i = 0; i < numOfItms; i++)
	{ 
		_itms.push_back((itms +   i));
	}
	return _itms;
}

In this instance, _itms is a private class variable defined as std::vector<Item*>. The error shows up at line 6. Visual C++ says this as an error: no instance of overloaded function: "std::vector<_Ty, _Ax>::push_back [with _Ty=game::items::Item *, _Ax=std::allocator<game::items::Item *>]" matches the argument list. I've even tried turning the statement (itms + i) into &itms (array style), but I still get the error.

Recommended Answers

All 2 Replies

what is the definition of _itms?

std::vector<Item*>()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.