|
|
|
|
|
|
std::map<sf::Vector2f, std::vector<Box>> boxMap;
|
|
1> main.cpp 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstddef(180): error C2678: binary '<' : no operator found which takes a left-hand operand of type 'const sf::Vector2f' (or there is no acceptable conversion) 1> c:\users\ben\c++ libs\sfml-2.0\include\sfml\system\time.hpp(185): could be 'bool sf::operator <(sf::Time,sf::Time)' [found using argument-dependent lookup] 1> c:\users\ben\c++ libs\sfml-2.0\include\sfml\system\string.hpp(398): or 'bool sf::operator <(const sf::String &,const sf::String &)' [found using argument-dependent lookup] 1> c:\users\ben\c++ libs\sfml-2.0\include\sfml\window\videomode.hpp(141): or 'bool sf::operator <(const sf::VideoMode &,const sf::VideoMode &)' [found using argument-dependent lookup] 1> c:\users\ben\c++ libs\sfml-2.0\include\sfml\network\ipaddress.hpp(227): or 'bool sf::operator <(const sf::IpAddress &,const sf::IpAddress &)' [found using argument-dependent lookup] 1> while trying to match the argument list '(const sf::Vector2f, const sf::Vector2f)' 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstddef(179) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const' 1> with 1> [ 1> _Ty=sf::Vector2f 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\map(194) : see reference to function template instantiation 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const' being compiled 1> with 1> [ 1> _Ty=sf::Vector2f 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\type_traits(743) : see reference to class template instantiation 'std::less<_Ty>' being compiled 1> with 1> [ 1> _Ty=sf::Vector2f 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(1028) : see reference to class template instantiation 'std::is_empty<_Ty>' being compiled 1> with 1> [ 1> _Ty=std::less<sf::Vector2f> 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\map(67) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled 1> with 1> [ 1> _Traits=std::_Tmap_traits<sf::Vector2f,std::vector<Box>,std::less<sf::Vector2f>,std::allocator<std::pair<const sf::Vector2f,std::vector<Box>>>,false> 1> ] 1> c:\users\ben\documents\visual studio 2012\projects\wxtimetest\main.cpp(28) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled 1> with 1> [ 1> _Kty=sf::Vector2f, 1> _Ty=std::vector<Box> 1> ] |
@Disch ok thanks, but what would a third element in my map do to how it functions? |
|
|
1> Board.cpp 1>c:\users\jordan\documents\visual studio 2012\projects\tictactoe\tictactoe\board.cpp(23): warning C4018: '<' : signed/unsigned mismatch 1>c:\users\jordan\documents\visual studio 2012\projects\tictactoe\tictactoe\board.cpp(31): warning C4018: '<' : signed/unsigned mismatch 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstddef(180): error C2678: binary '<' : no operator found which takes a left-hand operand of type 'const sf::Vector2f' (or there is no acceptable conversion) 1> c:\program files (x86)\sfml-2.1\include\sfml\system\time.hpp(185): could be 'bool sf::operator <(sf::Time,sf::Time)' [found using argument-dependent lookup] 1> c:\program files (x86)\sfml-2.1\include\sfml\system\string.hpp(398): or 'bool sf::operator <(const sf::String &,const sf::String &)' [found using argument-dependent lookup] 1> c:\program files (x86)\sfml-2.1\include\sfml\window\videomode.hpp(141): or 'bool sf::operator <(const sf::VideoMode &,const sf::VideoMode &)' [found using argument-dependent lookup] 1> while trying to match the argument list '(const sf::Vector2f, const sf::Vector2f)' 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstddef(179) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const' 1> with 1> [ 1> _Ty=sf::Vector2f 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\map(194) : see reference to function template instantiation 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const' being compiled 1> with 1> [ 1> _Ty=sf::Vector2f 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\type_traits(743) : see reference to class template instantiation 'std::less<_Ty>' being compiled 1> with 1> [ 1> _Ty=sf::Vector2f 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtree(1028) : see reference to class template instantiation 'std::is_empty<_Ty>' being compiled 1> with 1> [ 1> _Ty=std::less<sf::Vector2f> 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\map(67) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled 1> with 1> [ 1> _Traits=std::_Tmap_traits<sf::Vector2f,std::vector<Box>,std::less<sf::Vector2f>,std::allocator<std::pair<const sf::Vector2f,std::vector<Box>>>,false> 1> ] 1> c:\users\jordan\documents\visual studio 2012\projects\tictactoe\tictactoe\board.h(29) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled 1> with 1> [ 1> _Kty=sf::Vector2f, 1> _Ty=std::vector<Box> 1> ] ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== |
|
|
std::map<sf::Vector2f, std::vector<Box>> boxMap;
|
|
|
|
How do I use your version of the map? |
|
|
key.x=10 key.y=4 value=6 key.x=10 key.y=8 value=9 |
and then in my function [snip]for(std::map<sf::Vector2f, std::vector<Box>, VectorCompare<float>>::const_iterator it = boxMap.begin(); it != boxMap.end(); ++it){ |
|
|
I'm pretty close to scrapping the map idea and finding some other way to link an area of coordinates to a class object. |
Good god, man. Use auto or at least typedef that madness: |
Can you elaborate on what you're trying to do? Like at a high level, conceptual level? |
|
|
|
|
I want to give each of these box objects an area of coordinates on the screen that defines them, and access them when clicked |
|
|
|
|
|
|
|
|