diff --git a/src/Magnum/AbstractShaderProgram.cpp b/src/Magnum/AbstractShaderProgram.cpp index 8a24f51c3..53ed4ed91 100644 --- a/src/Magnum/AbstractShaderProgram.cpp +++ b/src/Magnum/AbstractShaderProgram.cpp @@ -275,11 +275,13 @@ bool AbstractShaderProgram::link(std::initializer_listget()._id); /* After linking phase, check status of all shaders */ Int i = 1; - for(AbstractShaderProgram& shader: shaders) { + for(auto it = shaders.begin(); it != shaders.end(); ++it) { + AbstractShaderProgram& shader = *it; + GLint success, logLength; glGetProgramiv(shader._id, GL_LINK_STATUS, &success); glGetProgramiv(shader._id, GL_INFO_LOG_LENGTH, &logLength); diff --git a/src/Magnum/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp index c9374ee5b..de6440b66 100644 --- a/src/Magnum/AbstractTexture.cpp +++ b/src/Magnum/AbstractTexture.cpp @@ -134,8 +134,8 @@ void AbstractTexture::bind(const Int firstTextureUnit, std::initializer_list textures) { Int unit = firstTextureUnit; - for(AbstractTexture* const texture: textures) { - if(texture) texture->bind(unit); + for(auto it = textures.begin(); it != textures.end(); ++it) { + if(*it) (*it)->bind(unit); else unbind(unit); ++unit; } @@ -148,8 +148,8 @@ void AbstractTexture::bindImplementationMulti(const GLint firstTextureUnit, std: /* Create array of IDs and also update bindings in state tracker */ Containers::Array ids{textures.size()}; Int i{}; - for(const AbstractTexture* const texture: textures) { - textureState->bindings[firstTextureUnit + i].second = ids[i] = texture ? texture->id() : 0; + for(auto it = textures.begin(); it != textures.end(); ++it) { + textureState->bindings[firstTextureUnit + i].second = ids[i] = *it ? (*it)->id() : 0; ++i; } diff --git a/src/Magnum/Context.cpp b/src/Magnum/Context.cpp index 94b12904d..949b17f0d 100644 --- a/src/Magnum/Context.cpp +++ b/src/Magnum/Context.cpp @@ -415,8 +415,8 @@ Context::Context() { /* Check for presence of future and vendor extensions */ const std::vector extensions = extensionStrings(); - for(const std::string& extension: extensions) { - const auto found = futureExtensions.find(extension); + for(auto it = extensions.begin(); it != extensions.end(); ++it) { + const auto found = futureExtensions.find(*it); if(found != futureExtensions.end()) { _supportedExtensions.push_back(found->second); extensionStatus.set(found->second._index); diff --git a/src/Magnum/Platform/magnum-info.cpp b/src/Magnum/Platform/magnum-info.cpp index ab4814a31..4c9e26e6a 100644 --- a/src/Magnum/Platform/magnum-info.cpp +++ b/src/Magnum/Platform/magnum-info.cpp @@ -152,11 +152,12 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat Debug() << "Context flags:"; #ifndef MAGNUM_TARGET_GLES - for(const auto flag: {Context::Flag::Debug, Context::Flag::RobustAccess}) + auto flags = {Context::Flag::Debug, Context::Flag::RobustAccess}; #else - for(const auto flag: {Context::Flag::Debug}) + auto flags = {Context::Flag::Debug}; #endif - if(c->flags() & flag) Debug() << " " << flag; + for(auto it = flags.begin(); it != flags.end(); ++it) + if(c->flags() & *it) Debug() << " " << *it; Debug() << "Supported GLSL versions:"; const std::vector shadingLanguageVersions = c->shadingLanguageVersionStrings(); diff --git a/src/Magnum/Shader.cpp b/src/Magnum/Shader.cpp index a0e76531a..ac6e795a1 100644 --- a/src/Magnum/Shader.cpp +++ b/src/Magnum/Shader.cpp @@ -634,7 +634,8 @@ bool Shader::compile(std::initializer_list> shade /* Allocate large enough array for source pointers and sizes (to avoid reallocating it for each of them) */ std::size_t maxSourceCount = 0; - for(Shader& shader: shaders) { + for(auto it = shaders.begin(); it != shaders.end(); ++it) { + Shader& shader = *it; CORRADE_ASSERT(shader._sources.size() > 1, "Shader::compile(): no files added", false); maxSourceCount = std::max(shader._sources.size(), maxSourceCount); } @@ -642,7 +643,8 @@ bool Shader::compile(std::initializer_list> shade Containers::Array sizes(maxSourceCount); /* Upload sources of all shaders */ - for(Shader& shader: shaders) { + for(auto it = shaders.begin(); it != shaders.end(); ++it) { + Shader& shader = *it; for(std::size_t i = 0; i != shader._sources.size(); ++i) { pointers[i] = static_cast(shader._sources[i].data()); sizes[i] = shader._sources[i].size(); @@ -652,11 +654,13 @@ bool Shader::compile(std::initializer_list> shade } /* Invoke (possibly parallel) compilation on all shaders */ - for(Shader& shader: shaders) glCompileShader(shader._id); + for(auto it = shaders.begin(); it != shaders.end(); ++it) glCompileShader(it->get()._id); /* After compilation phase, check status of all shaders */ Int i = 1; - for(Shader& shader: shaders) { + for(auto it = shaders.begin(); it != shaders.end(); ++it) { + Shader& shader = *it; + GLint success, logLength; glGetShaderiv(shader._id, GL_COMPILE_STATUS, &success); glGetShaderiv(shader._id, GL_INFO_LOG_LENGTH, &logLength);