template<typename T> void ResourceManager<T>::load(const std::string& filename)
{
typename std::vector<std::pair<std::string,T>>::iterator iter = getIterator(filename); // i get error here
if (iter == resources.end())
{
resources.emplace_back(filename,T());
if (resources.back().second.loadFromFile(filename))
{
std::cout << "loaded!";
}
}
}
template<typename T> const T& ResourceManager<T>::get(const std::string& filename)
{
typename std::vector<std::pair<std::string,T>>::iterator iter = getIterator(filename); // no error ( why? when it errors on other one )
if (iter == resources.end())
{
load(filename);
return resources[iter].second;
}
return resources.back().second;
}
as youve seen in the comments, i get a strange error at strange place
the error message says that getIterator has an error: it attempts to create std::vector<std::string, T> (as an argument to some lambda, but it doesn't matter why, vector expects T to be an allocator, and sf::Texture isn't one)
There is not enough code shown to answer that question. Perhaps you did not attempt to make a call to that get() function (if you don't use a member of a template it is not compiled)
In any case, the error message is about getIterator, specifically line 49 of "zde\resour..."
this const std::vector<std::string,T>& item ifails to compile because your T is not an allocator. I am guesing you meant const std::pair<std::string,T>& item -- or just use constauto& item if it's C++14