Skip to content

Fix ambiguous clamp and switch to std::chrono::milliseconds - #1973

Merged
Flow86 merged 7 commits into
masterfrom
clamp-fix
Aug 31, 2026
Merged

Fix ambiguous clamp and switch to std::chrono::milliseconds#1973
Flow86 merged 7 commits into
masterfrom
clamp-fix

Conversation

@Flamefire

Copy link
Copy Markdown
Member

C++17 introduced std::clamp which makes passing a type from std namespace (such as chrono-types) ambiguous in the semi-recursive call. Use constexpr-ifs and std::clamp in the final path.

@Flamefire
Flamefire requested a review from Flow86 August 26, 2026 10:09
@Flow86

Flow86 commented Aug 26, 2026

Copy link
Copy Markdown
Member

pipeline fails?

@Flamefire

Copy link
Copy Markdown
Member Author

Hm, seems like this didn't work standalone due to mixing duration types. Switching to use the chrono types consistently now. There was one place where we used our own 32 bit ms type but that's pretty much irrelevant now in 64bit days.
Using the standard types allows using the chrono literals too

For some reason it sometimes adds a space before `&`
C++17 introduced `std::clamp` which makes passing a type from std
namespace (such as chrono-types) ambiguous in the semi-recursive call.
Use constexpr-ifs and `std::clamp` in the final path.
@Flamefire Flamefire changed the title Fix ambiguous clamp Fix ambiguous clamp and switch to std::chrono::milliseconds Aug 27, 2026
Comment thread libs/s25main/network/GameClient.cpp Outdated
Comment thread libs/s25main/network/GameClient.cpp Outdated
Comment thread libs/s25main/network/GameServer.cpp Outdated
Comment thread libs/s25main/network/GameServer.cpp
Comment thread tests/testHelpers/rttr/test/TmpFolder.hpp
@Flow86
Flow86 merged commit 1813dfc into master Aug 31, 2026
20 of 21 checks passed
@Flow86
Flow86 deleted the clamp-fix branch August 31, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants