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

Author Topic: Make the sf::Time friends constexpr  (Read 526 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: 2999
  • My number of posts is shown in hexadecimal.
    • View Profile
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
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

Elias Daler

  • Hero Member
  • *****
  • Posts: 592
    • 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 | eliasdaler.github.io | @EliasDaler | Tomb Painter dev log

 

anything