Skip to content

Instantly share code, notes, and snippets.

@NTG-TPL
Created July 11, 2023 11:16
Show Gist options
  • Save NTG-TPL/73f3a114afac750224d31296a97b0614 to your computer and use it in GitHub Desktop.
Save NTG-TPL/73f3a114afac750224d31296a97b0614 to your computer and use it in GitHub Desktop.
Function compares all arguments with the first
// Checks if there is an argument equal to the first
template<typename T, typename ...Tail>
bool EqualsToOneOf(const T &t, const Tail&... tail){
if constexpr (sizeof...(tail) == 0) {
return false;
}else {
return ( (t == tail) || ...);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment