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

Author Topic: Make the sf::Time friends constexpr  (Read 11009 times)

0 Members and 1 Guest are viewing this topic.

Retr0Zero7

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Make the sf::Time friends constexpr
« on: May 16, 2020, 12:37:58 pm »
Hi!

I have been working on a bad little game engine using SFML lately, and to my surprise, I have encountred only one slight issue.

When I try to use modern C++,
constexpr auto interval = sf::milliseconds(5);
it just doesn't work.

It's really a shame that one can't do that. This should take a competent programmer (possibly me if I get convinced to make a PR) less than 30 minutes to fix. Thanks in advance.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Make the sf::Time friends constexpr
« Reply #1 on: May 17, 2020, 06:49:28 pm »
It's not just a single task, though, unfortunately as I'm pretty sure that most SFML types cannot be used in constexpr.
So, if you're going to fix that, fix them all! ;D
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re: Make the sf::Time friends constexpr
« Reply #2 on: May 20, 2020, 12:27:19 pm »
Also this means breaking C++03 compatibility. Laurent says he doesn't mind it, but to this day no one dared to do it.
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler