SFML community forums

General => Feature requests => Topic started by: Retr0Zero7 on May 16, 2020, 12:37:58 pm

Title: Make the sf::Time friends constexpr
Post by: Retr0Zero7 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.
Title: Re: Make the sf::Time friends constexpr
Post by: Hapax 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
Title: Re: Make the sf::Time friends constexpr
Post by: Elias Daler 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.