diff --git a/src/StdGL.h b/src/StdGL.h index 09b6750fb..33f76766c 100644 --- a/src/StdGL.h +++ b/src/StdGL.h @@ -30,6 +30,9 @@ #endif #include +#include +#include + class CStdWindow; class CStdGLShader : public CStdShader @@ -51,9 +54,6 @@ class CStdGLShader : public CStdShader class CStdGLShaderProgram : public CStdShaderProgram { -private: - template static constexpr bool isFunctionPointer{std::is_function_v>}; - public: using CStdShaderProgram::CStdShaderProgram; @@ -64,12 +64,14 @@ class CStdGLShaderProgram : public CStdShaderProgram void EnsureProgram() override; - template typename std::enable_if_t, bool> SetAttribute(std::string_view key, Func function, Args... args) + template requires std::invocable + bool SetAttribute(std::string_view key, Func function, Args... args) { return SetAttribute(key, &CStdGLShaderProgram::attributeLocations, glGetAttribLocation, function, args...); } - template typename std::enable_if_t, bool> SetUniform(std::string_view key, Func function, Args... args) + template requires std::invocable + bool SetUniform(std::string_view key, Func function, Args... args) { return SetAttribute(key, &CStdGLShaderProgram::uniformLocations, glGetUniformLocation, function, args...); } @@ -87,7 +89,10 @@ class CStdGLShaderProgram : public CStdShaderProgram void OnDeselect() override; using Locations = std::unordered_map; - template bool SetAttribute(std::string_view key, Locations CStdGLShaderProgram::*locationPointer, MapFunc mapFunction, SetFunc setFunction, Args... args) + + template + requires (std::is_invocable_r_v && std::invocable) + bool SetAttribute(std::string_view key, Locations CStdGLShaderProgram::*locationPointer, MapFunc mapFunction, SetFunc setFunction, Args... args) { assert(shaderProgram);