]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/scenegraph.cpp
Embrace lambdas
[xonotic/netradiant.git] / radiant / scenegraph.cpp
index 1f885cff9e16d73c7dd6b7945abb53a2e5be87a1..c1730c333ed31b7134c26733202bbc38b990a5c6 100644 (file)
 #include "instancelib.h"
 #include "treemodel.h"
 
-class StringEqualPredicate
-{
-const char* m_string;
-public:
-StringEqualPredicate( const char* string ) : m_string( string ){
-}
-bool operator()( const char* other ) const {
-       return string_equal( m_string, other );
-}
-};
-
 template<std::size_t SIZE>
 class TypeIdMap
 {
@@ -56,7 +45,9 @@ public:
 TypeIdMap() : m_typeNamesEnd( m_typeNames ){
 }
 TypeId getTypeId( const char* name ){
-       TypeName* i = std::find_if( m_typeNames, m_typeNamesEnd, StringEqualPredicate( name ) );
+       TypeName *i = std::find_if(m_typeNames, m_typeNamesEnd, [&](const char *other) {
+               return string_equal(name, other);
+       });
        if ( i == m_typeNamesEnd ) {
                ASSERT_MESSAGE( m_typeNamesEnd != m_typeNames + SIZE, "reached maximum number of type names supported (" << Unsigned( SIZE ) << ")" );
                *m_typeNamesEnd++ = name;