Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing import of <algorithm> #439

Merged
merged 1 commit into from
Feb 26, 2023
Merged

Fix missing import of <algorithm> #439

merged 1 commit into from
Feb 26, 2023

Conversation

ranisalt
Copy link
Contributor

Description

After ba20106 was pushed, a missing include to <algorithm> is necessary so that std::clamp is found. It is not included transitively by any other includes, at least not in the gcc and clang versions I am using to build.

Behaviour

Actual

/run/build/otclient/src/framework/core/asyncdispatcher.cpp: In member function ‘void AsyncDispatcher::init()’:
/run/build/otclient/src/framework/core/asyncdispatcher.cpp:31:32: error: ‘clamp’ is not a member of ‘std’
   31 |     int_fast8_t threads = std::clamp<int_fast8_t>(std::thread::hardware_concurrency() - 2, 1, ASYNC_DISPATCHER_MAX_THREAD);
      |                                ^~~~~
/run/build/otclient/src/framework/core/asyncdispatcher.cpp:31:49: error: expected primary-expression before ‘>’ token
   31 |     int_fast8_t threads = std::clamp<int_fast8_t>(std::thread::hardware_concurrency() - 2, 1, ASYNC_DISPATCHER_MAX_THREAD);
      |                                                 ^

Expected

It compiles

Fixes

N/A

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested

Fixes compilation in gcc 12 and clang 15

Test Configuration:

  • Server Version: N/A
  • Client: latest commit
  • Operating System: Arch Linux, but Freedesktop runtime (gcc 12.2.0 and clang 15.0.7 available)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

@mehah mehah merged commit 9799c9d into mehah:main Feb 26, 2023
@ranisalt ranisalt deleted the patch-1 branch February 27, 2023 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants