SFML community forums
Help => System => Topic started by: NobodyNothing on February 18, 2012, 05:33:35 am
-
I'm receiving this error:
Error 1 error C2678: binary '<' : no operator found which takes a left-hand operand of type 'const sf::Vector3i' (or there is no acceptable conversion) c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional 125
The only place in my game I'm using a const Vector3i (and non-coincidentally the place I was working on when this error was introduced) is in a TileManager class, subclassed from a Templated ResourceManager
//Shortcut for string & Tile reference & location
typedef std::pair<sf::Vector3i, Tile&> TileInfo;
class TileManager : public sftools::ResourceManager<Tile, TileInfo, sf::Vector3i>
{
public:
const sf::Vector3i& Load(const TileInfo& locator)
{
// Add the Texture to the manager
Add(locator.first, locator.second);
// Return the XYZ location
return locator.first;
}
};
The ResourceManger base class I'm deriving TileManager from is this (http://www.sfml-dev.org/wiki/en/sources/resource_manager_hiura) one from the wiki.
If anyone knows what could be causing the error, I would appreciate any help you could give
-
A type must have an operator< to be usable as a key in a std::map (because items are ordered by key in such a container). So either write this operator for sf::Vector3i, use a custom functor, or use another key type.
-
Thanks! Got it working now :)