From 0e122b1e3d04691b8a9b9f3f1b359c947cd94bf8 Mon Sep 17 00:00:00 2001
From: AnyOldName3 <krizdjali@gmail.com>
Date: Sun, 27 Jun 2021 01:48:06 +0100
Subject: [PATCH] Avoid copy and deep equality check

---
 components/shader/shadervisitor.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp
index d51dbfa6b9..b4455c4096 100644
--- a/components/shader/shadervisitor.cpp
+++ b/components/shader/shadervisitor.cpp
@@ -275,11 +275,11 @@ namespace Shader
         osg::StateSet::AttributeList removedAttributes;
         if (osg::ref_ptr<osg::StateSet> removedState = getRemovedState(*stateset))
             removedAttributes = removedState->getAttributeList();
-        for (const auto& attributeMap : { attributes, removedAttributes })
+        for (const auto* attributeMap : std::initializer_list<const osg::StateSet::AttributeList*>{ &attributes, &removedAttributes })
         {
-            for (osg::StateSet::AttributeList::const_iterator it = attributeMap.begin(); it != attributeMap.end(); ++it)
+            for (osg::StateSet::AttributeList::const_iterator it = attributeMap->begin(); it != attributeMap->end(); ++it)
             {
-                if (attributeMap != removedAttributes && removedAttributes.count(it->first))
+                if (attributeMap != &removedAttributes && removedAttributes.count(it->first))
                     continue;
                 if (it->first.first == osg::StateAttribute::MATERIAL)
                 {