Browse Source

GCC 4.5 compatibility: no range-based for.

Vladimír Vondruš 11 years ago
parent
commit
07d11280e9
  1. 3
      src/Magnum/AbstractShaderProgram.cpp
  2. 2
      src/Magnum/Platform/ScreenedApplication.hpp
  3. 11
      src/Magnum/SceneGraph/Object.hpp
  4. 8
      src/Magnum/SceneGraph/Test/ObjectTest.cpp

3
src/Magnum/AbstractShaderProgram.cpp

@ -319,7 +319,8 @@ void AbstractShaderProgram::setTransformFeedbackOutputs(const std::initializer_l
Containers::Array<const char*> names{outputs.size()};
Int i = 0;
for(const std::string& output: outputs) names[i++] = output.data();
for(auto it = outputs.begin(); it != outputs.end(); ++it)
names[i++] = it->data();
glTransformFeedbackVaryings(_id, outputs.size(), names, GLenum(bufferMode));
}

2
src/Magnum/Platform/ScreenedApplication.hpp

@ -84,7 +84,7 @@ template<class Application> void BasicScreenedApplication<Application>::viewport
/* Call global event before all other (to resize framebuffer first) */
globalViewportEvent(size);
for(BasicScreen<Application>& s: *this) s.viewportEvent(size);
for(auto it = begin(*this); it != end(*this); ++it) (*it).viewportEvent(size);
}
template<class Application> void BasicScreenedApplication<Application>::drawEvent() {

11
src/Magnum/SceneGraph/Object.hpp

@ -171,12 +171,12 @@ template<class Transformation> void Object<Transformation>::setDirty() {
if(flags & Flag::Dirty) return;
/* Make all features dirty */
for(AbstractFeature<Transformation::Dimensions, typename Transformation::Type>& feature: this->features())
feature.markDirty();
for(auto it = begin(this->features()); it != end(this->features()); ++it)
(*it).markDirty();
/* Make all children dirty */
for(Object<Transformation>& child: children())
child.setDirty();
for(auto it = begin(children()); it != end(children()); ++it)
(*it).setDirty();
/* Mark object as dirty */
flags |= Flag::Dirty;
@ -547,7 +547,8 @@ template<class Transformation> void Object<Transformation>::setCleanInternal(con
MatrixType matrix, invertedMatrix;
/* Clean all features */
for(AbstractFeature<Transformation::Dimensions, typename Transformation::Type>& feature: this->features()) {
for(auto it = begin(this->features()); it != end(this->features()); ++it) {
AbstractFeature<Transformation::Dimensions, typename Transformation::Type>& feature = *it;
/* Cached absolute transformation, compute it if it wasn't
computed already */
if(feature.cachedTransformations() & CachedTransformation::Absolute) {

8
src/Magnum/SceneGraph/Test/ObjectTest.cpp

@ -512,7 +512,11 @@ void ObjectTest::rangeBasedForChildren() {
Object3D c(&scene);
std::vector<Object3D*> objects;
#ifndef CORRADE_GCC45_COMPATIBILITY
for(auto&& i: scene.children()) objects.push_back(&i);
#else
for(auto it = begin(scene.children()); it != end(scene.children()); ++it) objects.push_back(&*it);
#endif
CORRADE_COMPARE(objects, (std::vector<Object3D*>{&a, &b, &c}));
}
@ -527,7 +531,11 @@ void ObjectTest::rangeBasedForFeatures() {
Feature c(object);
std::vector<AbstractFeature3D*> features;
#ifndef CORRADE_GCC45_COMPATIBILITY
for(auto&& i: object.features()) features.push_back(&i);
#else
for(auto it = begin(object.features()); it != end(object.features()); ++it) features.push_back(&*it);
#endif
CORRADE_COMPARE(features, (std::vector<AbstractFeature3D*>{&a, &b, &c}));
}

Loading…
Cancel
Save