]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/builtin.cpp
Use C++11 features with containers
[libs/gl.git] / source / glsl / builtin.cpp
index 83e480e5cf417b5943abb7841ebcb32256f8136e..8e18d6eb97d031e5f0becbef55a01c0fc782a22e 100644 (file)
@@ -1,3 +1,4 @@
+#include <msp/core/algorithm.h>
 #include <msp/gl/resources.h>
 #include <msp/io/seekable.h>
 #include "builtin.h"
@@ -62,10 +63,8 @@ const Stage *get_builtins(Stage::Type type)
 
        if(type==Stage::SHARED)
                return &module->shared;
-       for(list<Stage>::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)
-               if(i->type==type)
-                       return &*i;
-       return 0;
+       auto i = find_member(module->stages, type, &Stage::type);
+       return (i!=module->stages.end() ? &*i : 0);
 }
 
 } // namespace SL