SFML community forums

General => Feature requests => Topic started by: korczurekk on July 26, 2017, 08:48:08 pm

Title: Vector2 and Color std::get overloads
Post by: korczurekk on July 26, 2017, 08:48:08 pm
It would be nice to have sf::Vector2<t> and sf::Color compatibile with std::get<N> in order to make them more generic and usable with other libraries like boost.geometry. I know I can overload that myself, but it's a bad practice to do stuff like that with other's code as it might break in future.
I can't really imagine any kind of drawbacks due to extraordinarily small scale of requested changes and would be really happy to see it implemented.

Ps. I can write (and maintain) needed code and send a PR if headdevs approve my proposal, I'm somehow familiar with SFML code guidelines.
Title: Re: Vector2 and Color std::get overloads
Post by: Laurent on July 26, 2017, 09:04:20 pm
Would you mind explaining what "compatible with std::get<N>" means? Those who don't know (including me) may not understand what you're asking for ;)
Title: Re: Vector2 and Color std::get overloads
Post by: korczurekk on July 26, 2017, 10:19:43 pm
Sooo, nevermind.
Longer version: I researched the topic once again as overloading stuff from std namespace seemed strange and I found out, that doing so is indeed sometimes used, but not recommended (like, really NOT RECOMMENDED) by the standard. TBH such code should be considered ill-formed and misdesigned. Oh, and in case of boost.geometry it was actually custom get function in a different namespace which was then inlined (that's how you call using namespace stuff;?) hence my image of said situation was wrong.

Man, killing off (is that even a correct collocation?) my own proposal feels bad.
Sorry for the fuss, I should have looked into it thoroughly.