I\'ve got this function:
template
void Inventory::insertItem(std::vector& v, const T& x)
{
std::vector<
What you are doing is inefficient. Use a binary search instead:
#include <algorithm>
template <typename T>
void insertItem(std::vector<T>& v, const T& x)
{
v.insert(std::upper_bound(v.begin(), v.end(), x), x);
}
Try this instead:
typename std::vector<T>::iterator it;
Here's a page that describes how to use typename and why it's necessary here.