Fix matching function call for min - #323
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On MacOS Clang, the line:
size_t count = std::min(pos + samples, Data.size()) - pos;Fails with:
So add a cast to std::min to please the compiler
Compiler used: