diff --git a/indra/llaudio/llstreamingaudio_fmodstudio.cpp b/indra/llaudio/llstreamingaudio_fmodstudio.cpp
index 03095376a11700d6dea8416efe7606a6c4bdf2fa..a344673da8b628b689259c670ba7be220ca8cef5 100644
--- a/indra/llaudio/llstreamingaudio_fmodstudio.cpp
+++ b/indra/llaudio/llstreamingaudio_fmodstudio.cpp
@@ -641,8 +641,7 @@ void LLStreamingAudio_FMODSTUDIO::setBufferSizes(U32 streambuffertime, U32 decod
 bool LLStreamingAudio_FMODSTUDIO::releaseDeadStreams()
 {
 	// Kill dead internet streams, if possible
-	std::list<LLAudioStreamManagerFMODSTUDIO *>::iterator iter;
-	for (iter = mDeadStreams.begin(); iter != mDeadStreams.end();)
+	for (auto iter = mDeadStreams.begin(); iter != mDeadStreams.end();)
 	{
 		LLAudioStreamManagerFMODSTUDIO *streamp = *iter;
 		if (streamp->stopStream())
diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp
index 6c051770f0411718164a1547467133f944db60d0..10623b013b5a37a51a531b86d41245f47ff8a2cb 100644
--- a/indra/llcharacter/llmotioncontroller.cpp
+++ b/indra/llcharacter/llmotioncontroller.cpp
@@ -216,11 +216,8 @@ void LLMotionController::purgeExcessMotions()
 	{
 		// too many motions active this frame, kill all blenders
 		mPoseBlender.clearBlenders();
-		for (auto loaded_motion_it = mLoadedMotions.cbegin(); 
-			 loaded_motion_it != mLoadedMotions.cend(); 
-			 ++loaded_motion_it)
+		for (LLMotion* cur_motionp : mLoadedMotions)
 		{
-			LLMotion* cur_motionp = *loaded_motion_it;
 			// motion isn't playing, delete it
 			if (!isMotionActive(cur_motionp))
 			{
@@ -230,13 +227,10 @@ void LLMotionController::purgeExcessMotions()
 	}
 	
 	// clean up all inactive, loaded motions
-	for (auto motion_it = motions_to_kill.begin();
-		motion_it != motions_to_kill.end();
-		++motion_it)
+	for (const auto& motion_id : motions_to_kill)
 	{
 		// look up the motion again by ID to get canonical instance
 		// and kill it only if that one is inactive
-		LLUUID motion_id = *motion_it;
 		LLMotion* motionp = findMotion(motion_id);
 		if (motionp && !isMotionActive(motionp))
 		{
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 6b160e7401775dd08ccf16cec918bed8d863f97c..c888ca85b88a5ac0f4cc6b547fb006976fad4b16 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -398,7 +398,7 @@ public:
 			max = *(tri->mV[0]);
 			
 			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = 
-				branch->getDataBegin(); iter != branch->getDataEnd(); ++iter)
+				branch->getDataBegin(), iter_end = branch->getDataEnd(); iter != iter_end; ++iter)
 			{ //for each triangle in node
 
 				//stretch by triangles in node
diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp
index 44e7fde97034a804d1cde40ec3ce4e86a7653e86..e8757872b7e6cae45b4a77a074c1c827a279b1df 100644
--- a/indra/llmath/llvolumeoctree.cpp
+++ b/indra/llmath/llvolumeoctree.cpp
@@ -125,7 +125,7 @@ void LLOctreeTriangleRayIntersect::traverse(const LLOctreeNode<LLVolumeTriangle>
 void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle>* node)
 {
 	for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = 
-			node->getDataBegin(); iter != node->getDataEnd(); ++iter)
+			node->getDataBegin(), iter_end = node->getDataEnd(); iter != iter_end; ++iter)
 	{
 		const LLVolumeTriangle* tri = *iter;
 
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 9fe89a91fe17f5718d74c7ea49b7431cfd9f9bd8..fa09fd794a06e3e5b021567c38e9ef5a4eaac471 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -2127,9 +2127,8 @@ void LLDrawPoolAvatar::updateRiggedVertexBuffers(LLVOAvatar* avatar)
 	//update rigged vertex buffers
 	for (U32 type = 0; type < NUM_RIGGED_PASSES; ++type)
 	{
-		for (U32 i = 0; i < mRiggedFace[type].size(); ++i)
+		for (LLFace* face : mRiggedFace[type])
 		{
-			LLFace* face = mRiggedFace[type][i];
 			LLDrawable* drawable = face->getDrawable();
 			if (!drawable)
 			{
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index f72becf1ca62e2cfb257b791ca82d09a94fd9195..d89c96dda8aa15e35e4c84857fdb2af6dc3b458a 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -758,7 +758,7 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node)
 	}
 	setState(DEAD);	
 
-	for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)
+	for (element_iter i = getDataBegin(), i_end = getDataEnd(); i != i_end; ++i)
 	{
 		LLViewerOctreeEntry* entry = *i;
 
@@ -815,7 +815,7 @@ void LLSpatialGroup::destroyGL(bool keep_occlusion)
 	}
 
 
-	for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i)
+	for (LLSpatialGroup::element_iter i = getDataBegin(), i_end = getDataEnd(); i != i_end; ++i)
 	{
 		LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
 		if(!drawable)
@@ -1169,7 +1169,7 @@ public:
 		LLSpatialGroup* group = (LLSpatialGroup*)base_group;
 		OctreeNode* branch = group->getOctreeNode();
 
-		for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
+		for (OctreeNode::const_element_iter i = branch->getDataBegin(), i_end = branch->getDataEnd(); i != i_end; ++i)
 		{
 			LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
 			if(!drawable)
@@ -1310,7 +1310,7 @@ public:
 		LLSpatialGroup* group = (LLSpatialGroup*) state->getListener(0);
 		group->destroyGL();
 
-		for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+		for (LLSpatialGroup::element_iter i = group->getDataBegin(), i_end = group->getDataEnd(); i != i_end; ++i)
 		{
 			LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable();
 			if(!drawable)
@@ -1327,9 +1327,8 @@ public:
 			}
 		}
 
-		for (LLSpatialGroup::bridge_list_t::iterator i = group->mBridgeList.begin(); i != group->mBridgeList.end(); ++i)
+		for (LLSpatialBridge* bridge : group->mBridgeList)
 		{
-			LLSpatialBridge* bridge = *i;
 			traverse(bridge->mOctree);
 		}
 	}
@@ -1443,13 +1442,10 @@ void pushVerts(LLDrawInfo* params, U32 mask)
 
 void pushVerts(LLSpatialGroup* group, U32 mask)
 {
-	LLDrawInfo* params = NULL;
-
-	for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
+	for (auto& pair : group->mDrawMap)
 	{
-		for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j) 
+		for (LLDrawInfo* params : pair.second)
 		{
-			params = *j;
 			pushVerts(params, mask);
 		}
 	}
@@ -1516,13 +1512,13 @@ void pushBufferVerts(LLSpatialGroup* group, U32 mask, bool push_alpha = true)
 				pushBufferVerts(group->mVertexBuffer, mask);
 			}
 
-			for (LLSpatialGroup::buffer_map_t::iterator i = group->mBufferMap.begin(); i != group->mBufferMap.end(); ++i)
+			for (auto& buff_pair : group->mBufferMap)
 			{
-				for (LLSpatialGroup::buffer_texture_map_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
+				for (auto& buff_tex_pair : buff_pair.second)
 				{
-					for (LLSpatialGroup::buffer_list_t::iterator k = j->second.begin(); k != j->second.end(); ++k)
+					for (LLVertexBuffer* buff : buff_tex_pair.second)
 					{
-						pushBufferVerts(*k, mask);
+						pushBufferVerts(buff, mask);
 					}
 				}
 			}
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index c90ad4b8c74a85ef5c46bd12487163ad4c1c5a2c..e07c6d7fab0954bb0017bd50e3c9abe88e46d400 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -913,9 +913,9 @@ void LLViewerObjectList::update(LLAgent &agent)
 			{
 				if (idle_count >= idle_list.size())
 				{
-                    idle_list.push_back( objectp );
-                }
-			else
+					idle_list.push_back(objectp);
+				}
+				else
 				{
 					idle_list[idle_count] = objectp;
 				}
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 4762cb7554dc6aee99cf27a57e9316bfecbf240f..c1062fd8d3141e46fb0e0a8d8b71ce7fb07e985e 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -9778,10 +9778,8 @@ void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes)
         {
             volumes.push_back(volp);
             LLViewerObject::const_child_list_t& children = volp->getChildren();
-            for (LLViewerObject::const_child_list_t::const_iterator it = children.begin();
-                 it != children.end(); ++it)
+            for (LLViewerObject* childp : children)
             {
-                LLViewerObject *childp = *it;
                 LLVOVolume *volume = childp ? childp->asVolume() : nullptr;
                 if (volume)
                 {
@@ -9801,7 +9799,9 @@ void LLVOAvatar::updateRiggingInfo()
 {
     LL_RECORD_BLOCK_TIME(FTM_AVATAR_RIGGING_INFO_UPDATE);
 
+#if LL_DEBUG
     LL_DEBUGS("RigSpammish") << getFullname() << " updating rig tab" << LL_ENDL;
+#endif
 
     std::vector<LLVOVolume*> volumes;
 
@@ -9835,18 +9835,19 @@ void LLVOAvatar::updateRiggingInfo()
 	// Something changed. Update.
 	mLastRiggingInfoKeyHash = hash;
     mJointRiggingInfoTab.clear();
-    for (std::vector<LLVOVolume*>::iterator it = volumes.begin(); it != volumes.end(); ++it)
+    for (LLVOVolume* vol : volumes)
     {
-        LLVOVolume *vol = *it;
         vol->updateRiggingInfo();
         mJointRiggingInfoTab.merge(vol->mJointRiggingInfoTab);
     }
 
+#if LL_DEBUG
     //LL_INFOS() << "done update rig count is " << countRigInfoTab(mJointRiggingInfoTab) << LL_ENDL;
-    //LL_DEBUGS("RigSpammish") << getFullname() << " after update rig tab:" << LL_ENDL;
-    //S32 joint_count, box_count;
-    //showRigInfoTabExtents(this, mJointRiggingInfoTab, joint_count, box_count);
-    //LL_DEBUGS("RigSpammish") << "uses " << joint_count << " joints " << " nonzero boxes: " << box_count << LL_ENDL;
+    LL_DEBUGS("RigSpammish") << getFullname() << " after update rig tab:" << LL_ENDL;
+    S32 joint_count, box_count;
+    showRigInfoTabExtents(this, mJointRiggingInfoTab, joint_count, box_count);
+    LL_DEBUGS("RigSpammish") << "uses " << joint_count << " joints " << " nonzero boxes: " << box_count << LL_ENDL;
+#endif
 }
 
 // virtual
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 68221a60fca71180daa7d38481a28140a4867f74..3436bb926dad26d80509a80143973ee65ce02f92 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1500,9 +1500,8 @@ void LLPipeline::dirtyPoolObjectTextures(const std::set<LLViewerFetchedTexture*>
 	// *TODO: This is inefficient and causes frame spikes; need a better way to do this
 	//        Most of the time is spent in dirty.traverse.
 
-	for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
+	for (LLDrawPool* poolp : mPools)
 	{
-		LLDrawPool *poolp = *iter;
 		if (poolp->isFacePool())
 		{
 			((LLFacePool*) poolp)->dirtyTextures(textures);
@@ -2659,7 +2658,7 @@ void LLPipeline::doOcclusion(LLCamera& camera)
 		}
 		mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
 
-		for (LLCullResult::sg_iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter)
+		for (LLCullResult::sg_iterator iter = sCull->beginOcclusionGroups(), iter_end = sCull->endOcclusionGroups(); iter != iter_end; ++iter)
 		{
 			LLSpatialGroup* group = *iter;
 			group->doOcclusion(&camera);
@@ -2733,11 +2732,8 @@ void LLPipeline::clearRebuildGroups()
 
 	mGroupQ1Locked = true;
 	// Iterate through all drawables on the priority build queue,
-	for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin();
-		 iter != mGroupQ1.end(); ++iter)
+	for (LLSpatialGroup* group : mGroupQ1)
 	{
-		LLSpatialGroup* group = *iter;
-
 		// If the group contains HUD objects, save the group
 		if (group->isHUDGroup())
 		{
@@ -2761,11 +2757,8 @@ void LLPipeline::clearRebuildGroups()
 	hudGroups.clear();
 
 	mGroupQ2Locked = true;
-	for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ2.begin();
-		 iter != mGroupQ2.end(); ++iter)
+	for (LLSpatialGroup* group : mGroupQ2)
 	{
-		LLSpatialGroup* group = *iter;
-
 		// If the group contains HUD objects, save the group
 		if (group->isHUDGroup())
 		{
@@ -2788,10 +2781,8 @@ void LLPipeline::clearRebuildGroups()
 void LLPipeline::clearRebuildDrawables()
 {
 	// Clear all drawables on the priority build queue,
-	for (LLDrawable::drawable_list_t::iterator iter = mBuildQ1.begin();
-		 iter != mBuildQ1.end(); ++iter)
+	for (LLDrawable* drawablep : mBuildQ1)
 	{
-		LLDrawable* drawablep = *iter;
 		if (drawablep && !drawablep->isDead())
 		{
 			drawablep->clearState(LLDrawable::IN_REBUILD_Q2);
@@ -2801,10 +2792,8 @@ void LLPipeline::clearRebuildDrawables()
 	mBuildQ1.clear();
 
 	// clear drawables on the non-priority build queue
-	for (LLDrawable::drawable_list_t::iterator iter = mBuildQ2.begin();
-		 iter != mBuildQ2.end(); ++iter)
+	for (LLDrawable* drawablep : mBuildQ2)
 	{
-		LLDrawable* drawablep = *iter;
 		if (!drawablep->isDead())
 		{
 			drawablep->clearState(LLDrawable::IN_REBUILD_Q2);
@@ -2813,19 +2802,15 @@ void LLPipeline::clearRebuildDrawables()
 	mBuildQ2.clear();
 	
 	//clear all moving bridges
-	for (LLDrawable::drawable_vector_t::iterator iter = mMovedBridge.begin();
-		 iter != mMovedBridge.end(); ++iter)
+	for (LLDrawable* drawablep : mMovedBridge)
 	{
-		LLDrawable *drawablep = *iter;
 		drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD);
 	}
 	mMovedBridge.clear();
 
 	//clear all moving drawables
-	for (LLDrawable::drawable_vector_t::iterator iter = mMovedList.begin();
-		 iter != mMovedList.end(); ++iter)
+	for (LLDrawable* drawablep : mMovedList)
 	{
-		LLDrawable *drawablep = *iter;
 		drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD);
 	}
 	mMovedList.clear();
@@ -2841,10 +2826,8 @@ void LLPipeline::rebuildPriorityGroups()
 
 	mGroupQ1Locked = true;
 	// Iterate through all drawables on the priority build queue,
-	for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ1.begin();
-		 iter != mGroupQ1.end(); ++iter)
+	for (LLSpatialGroup* group : mGroupQ1)
 	{
-		LLSpatialGroup* group = *iter;
 		group->rebuildGeom();
 		group->clearState(LLSpatialGroup::IN_BUILD_Q1);
 	}
@@ -3124,10 +3107,8 @@ void LLPipeline::shiftObjects(const LLVector3 &offset)
 	{
 		LL_RECORD_BLOCK_TIME(FTM_SHIFT_DRAWABLE);
 
-		for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin();
-			 iter != mShiftList.end(); iter++)
+		for (LLDrawable* drawablep : mShiftList)
 		{
-			LLDrawable *drawablep = *iter;
 			if (drawablep->isDead())
 			{
 				continue;
@@ -3135,7 +3116,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset)
 			drawablep->shiftPos(offseta);	
 			drawablep->clearState(LLDrawable::ON_SHIFT_LIST);
 		}
-		mShiftList.resize(0);
+		mShiftList.clear();
 	}
 
 	
@@ -3193,9 +3174,8 @@ static LLTrace::BlockTimerStatHandle FTM_PROCESS_PARTITIONQ("PartitionQ");
 void LLPipeline::processPartitionQ()
 {
 	LL_RECORD_BLOCK_TIME(FTM_PROCESS_PARTITIONQ);
-	for (LLDrawable::drawable_list_t::iterator iter = mPartitionQ.begin(); iter != mPartitionQ.end(); ++iter)
+	for (LLDrawable* drawable : mPartitionQ)
 	{
-		LLDrawable* drawable = *iter;
 		if (!drawable->isDead())
 		{
 			drawable->updateBinRadius();
@@ -3527,7 +3507,7 @@ void forAllDrawables(LLCullResult::sg_iterator begin,
 {
 	for (LLCullResult::sg_iterator i = begin; i != end; ++i)
 	{
-		for (LLSpatialGroup::element_iter j = (*i)->getDataBegin(); j != (*i)->getDataEnd(); ++j)
+		for (LLSpatialGroup::element_iter j = (*i)->getDataBegin(), j_end = (*i)->getDataEnd(); j != j_end; ++j)
 		{
 			if((*j)->hasDrawable())
 			{
@@ -5500,9 +5480,8 @@ void LLPipeline::resetDrawOrders()
 {
 	assertInitialized();
 	// Iterate through all of the draw pools and rebuild them.
-	for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
+	for (LLDrawPool* poolp : mPools)
 	{
-		LLDrawPool *poolp = *iter;
 		poolp->resetDrawOrders();
 	}
 }
@@ -5822,8 +5801,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
 	
 	if (mLightingDetail >= 1)
 	{
-		for (light_set_t::iterator iter = mNearbyLights.begin();
-			 iter != mNearbyLights.end(); ++iter)
+		for (light_set_t::iterator iter = mNearbyLights.begin(), iter_end = mNearbyLights.end();
+			 iter != iter_end; ++iter)
 		{
 			LLDrawable* drawable = iter->drawable;
 			LLVOVolume* light = drawable->getVOVolume();
@@ -6201,9 +6180,8 @@ bool LLPipeline::verify()
 	bool ok = assertInitialized();
 	if (ok) 
 	{
-		for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter)
+		for (LLDrawPool* poolp : mPools)
 		{
-			LLDrawPool *poolp = *iter;
 			if (!poolp->verify())
 			{
 				ok = false;
@@ -8574,10 +8552,8 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
 				mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
 				
 				LLGLDepthTest depth(GL_TRUE, GL_FALSE);
-				for (LLDrawable::drawable_set_t::iterator iter = mLights.begin(); iter != mLights.end(); ++iter)
+				for (LLDrawable* drawablep : mLights)
 				{
-					LLDrawable* drawablep = *iter;
-					
 					LLVOVolume* volume = drawablep->getVOVolume();
 					if (!volume)
 					{
@@ -8680,11 +8656,9 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
 
 				gDeferredSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION);
 
-				for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter)
+				for (LLDrawable* drawablep : spot_lights)
 				{
 					LL_RECORD_BLOCK_TIME(FTM_PROJECTORS);
-					LLDrawable* drawablep = *iter;
-
 					LLVOVolume* volume = drawablep->getVOVolume();
 
 					LLVector4a center;
@@ -8766,11 +8740,9 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
 
 				gDeferredMultiSpotLightProgram.enableTexture(LLShaderMgr::DEFERRED_PROJECTION);
 
-				for (LLDrawable::drawable_list_t::iterator iter = fullscreen_spot_lights.begin(); iter != fullscreen_spot_lights.end(); ++iter)
+				for (LLDrawable* drawablep : fullscreen_spot_lights)
 				{
 					LL_RECORD_BLOCK_TIME(FTM_PROJECTORS);
-					LLDrawable* drawablep = *iter;
-					
 					LLVOVolume* volume = drawablep->getVOVolume();
 
 					LLVector3 center = drawablep->getPositionAgent();
@@ -9790,9 +9762,9 @@ void LLPipeline::renderHighlight(const LLViewerObject* obj, F32 fade)
 {
 	if (obj && obj->getVolume())
 	{
-		for (LLViewerObject::child_list_t::const_iterator iter = obj->getChildren().begin(); iter != obj->getChildren().end(); ++iter)
+		for (const LLViewerObject* childp : obj->getChildren())
 		{
-			renderHighlight(*iter, fade);
+			renderHighlight(childp, fade);
 		}
 
 		LLDrawable* drawable = obj->mDrawable;
@@ -10714,16 +10686,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
 		LLVOAvatar::sUseImpostors = false; // @TODO ???
 
 		LLVOAvatar::attachment_map_t::iterator iter;
-		for (iter = avatar->mAttachmentPoints.begin();
-			iter != avatar->mAttachmentPoints.end();
-			++iter)
+		for (const auto& attach_pair : avatar->mAttachmentPoints)
 		{
-			LLViewerJointAttachment *attachment = iter->second;
-			for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
-				 attachment_iter != attachment->mAttachedObjects.end();
-				 ++attachment_iter)
+			for (LLViewerObject* attached_object : attach_pair.second->mAttachedObjects)
 			{
-				if (LLViewerObject* attached_object = (*attachment_iter))
+				if (attached_object)
 				{
 					markVisible(attached_object->mDrawable->getSpatialBridge(), *viewer_camera);
 				}