Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Vector2 and Color std::get overloads  (Read 3779 times)

0 Members and 1 Guest are viewing this topic.

korczurekk

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • Email
Vector2 and Color std::get overloads
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Vector2 and Color std::get overloads
« Reply #1 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 ;)
Laurent Gomila - SFML developer

korczurekk

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • Email
Re: Vector2 and Color std::get overloads
« Reply #2 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.
« Last Edit: July 27, 2017, 03:37:16 pm by korczurekk »

 

anything