General => Feature requests => Topic started by: Neil on December 29, 2014, 08:03:32 pm
Title: Add public typedef to Vector2
Post by: Neil on December 29, 2014, 08:03:32 pm
Hi
Could this be added to Vector2 type please?
typedef T type;
I have some general template code, but I'm stuck, because I cannot query the type contained in vector. I would like to do Vector2::type.
Thank you.
Title: Re: Add public typedef to Vector2
Post by: eXpl0it3r on December 29, 2014, 08:12:00 pm
Why do you need to "query" that?
If you're in a general template code, you either should be able to assume a certain type or use the template type and since sf::Vector2 is a template as well, you could just do sf::Vector2<T>.
Title: Re: Add public typedef to Vector2
Post by: Laurent on December 29, 2014, 09:06:21 pm
Do it yourself:
template<typename T> struct TypeOfVector { };
template<typename T> struct TypeOfVector<sf::Vector2<T>> { typedef T type; };