Yes it's possible, since the requirements for the key type are that it must be copiable and assignable.
But since std::map is ordered it also requires a ordering function, by default (i.e. if you don't specify one) it will use operator<, which for sf::Vector3<T> is not declared (see
documentation), that's why you're getting that error.
The std::map deceleration is:
template < class Key, class T, class Compare = less<Key>, class Allocator = allocator<pair<const Key,T> > > class map;
For which
the reference states:
- Key: Type of the key values. Each element in a map is uniquely identified by its key value.
- T: Type of the mapped value. Each element in a map is used to store some data as its mapped value.
- Compare: Comparison class: A class that takes two arguments of the key type and returns a bool. The expression comp(a,b), where comp is an object of this comparison class and a and b are key values, shall return true if a is to be placed at an earlier position than b in a strict weak ordering operation. This can either be a class implementing a function call operator or a pointer to a function (see constructor for an example). This defaults to less<Key>, which returns the same as applying the less-than operator (a<b).
The map object uses this expression to determine the position of the elements in the container. All elements in a map container are ordered following this rule at all times. - Allocator: Type of the allocator object used to define the storage allocation model. By default, the allocator class template is used, which defines the simplest memory allocation model and is value-independent.
Thus you'll have to define a compare functor to pass as third argument of the vector decelration.