Skip to content

Fix matching function call for min - #323

Merged
dpjudas merged 1 commit into
dpjudas:masterfrom
SheatNoisette:std_min_fix
Aug 16, 2026
Merged

Fix matching function call for min#323
dpjudas merged 1 commit into
dpjudas:masterfrom
SheatNoisette:std_min_fix

Conversation

@SheatNoisette

@SheatNoisette SheatNoisette commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

On MacOS Clang, the line:

size_t count = std::min(pos + samples, Data.size()) - pos;

Fails with:

SurrealEngine/SurrealEngine/Video/VideoPlayer.cpp:41:18: error: no matching function for call to 'min'
                size_t count = std::min(pos + samples, Data.size()) - pos;
                               ^~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/min.h:40:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('uint64_t' (aka 'unsigned long long') vs. 'size_type' (aka 'unsigned long'))
min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/min.h:51:1: note: candidate template ignored: could not match 'initializer_list<_Tp>' against 'uint64_t' (aka 'unsigned long long')
min(initializer_list<_Tp> __t, _Compare __comp)

So add a cast to std::min to please the compiler

Compiler used:

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

On MacOS Clang, the line:
```
size_t count = std::min(pos + samples, Data.size()) - pos;
```
Fails with:
```
SurrealEngine/SurrealEngine/Video/VideoPlayer.cpp:41:18: error: no matching function for call to 'min'
                size_t count = std::min(pos + samples, Data.size()) - pos;
                               ^~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/min.h:40:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('uint64_t' (aka 'unsigned long long') vs. 'size_type' (aka 'unsigned long'))
min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b)
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/min.h:51:1: note: candidate template ignored: could not match 'initializer_list<_Tp>' against 'uint64_t' (aka 'unsigned long long')
min(initializer_list<_Tp> __t, _Compare __comp)
```

So add a cast to std::min to please the compiler.
@dpjudas
dpjudas merged commit a49c37b into dpjudas:master Aug 16, 2026
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