Index: src/GenPoly/Box.cc
===================================================================
--- src/GenPoly/Box.cc	(revision 4da152af87cdafc91c96ad9ffda2dff105a17db6)
+++ src/GenPoly/Box.cc	(revision d2ad1518036350cdec12ea05fd951c3f04312459)
@@ -582,4 +582,5 @@
 			assert( funcType );
 
+			// These iterators don't advance in unison.
 			std::list< DeclarationWithType* >::const_iterator fnParm = funcType->get_parameters().begin();
 			std::list< Expression* >::const_iterator fnArg = arg;
@@ -855,15 +856,13 @@
 			Statement *bodyStmt;
 
-			Type::ForallList::const_iterator tyArg = realType->forall.begin();
-			Type::ForallList::const_iterator tyParam = adapterType->forall.begin();
-			Type::ForallList::const_iterator realTyParam = adaptee->forall.begin();
-			for ( ; tyParam != adapterType->get_forall().end(); ++tyArg, ++tyParam, ++realTyParam ) {
-				assert( tyArg != realType->get_forall().end() );
-				std::list< DeclarationWithType *>::const_iterator assertArg = (*tyArg)->get_assertions().begin();
-				std::list< DeclarationWithType *>::const_iterator assertParam = (*tyParam)->get_assertions().begin();
-				std::list< DeclarationWithType *>::const_iterator realAssertParam = (*realTyParam)->get_assertions().begin();
-				for ( ; assertParam != (*tyParam)->get_assertions().end(); ++assertArg, ++assertParam, ++realAssertParam ) {
-					assert( assertArg != (*tyArg)->get_assertions().end() );
-					adapteeApp->get_args().push_back( makeAdapterArg( *assertParam, *assertArg, *realAssertParam, tyVars ) );
+			for ( auto tys : group_iterate( realType->forall, adapterType->forall, adaptee->forall ) ) {
+				TypeDecl * tyArg = std::get<0>( tys );
+				TypeDecl * tyParam = std::get<1>( tys );
+				TypeDecl * realTyParam = std::get<2>( tys );
+				for ( auto asserts : group_iterate( tyArg->assertions, tyParam->assertions, realTyParam->assertions ) ) {
+					DeclarationWithType * assertArg = std::get<0>( asserts );
+					DeclarationWithType * assertParam = std::get<1>( asserts );
+					DeclarationWithType * realAssertParam = std::get<2>( asserts );
+					adapteeApp->args.push_back( makeAdapterArg( assertParam, assertArg, realAssertParam, tyVars ) );
 				} // for
 			} // for
@@ -1093,6 +1092,6 @@
 		Expression *Pass1::postmutate( ApplicationExpr *appExpr ) {
 			// std::cerr << "mutate appExpr: " << InitTweak::getFunctionName( appExpr ) << std::endl;
-			// for ( TyVarMap::iterator i = scopeTyVars.begin(); i != scopeTyVars.end(); ++i ) {
-			// 	std::cerr << i->first << " ";
+			// for ( auto tyVar : scopeTyVars ) {
+			// 	std::cerr << tyVar.first << " ";
 			// }
 			// std::cerr << "\n";
@@ -1683,10 +1682,10 @@
 			bool hasDynamicLayout = false;
 
-			std::list< TypeDecl* >::const_iterator baseParam = baseParams.begin();
-			std::list< Expression* >::const_iterator typeParam = typeParams.begin();
-			for ( ; baseParam != baseParams.end() && typeParam != typeParams.end(); ++baseParam, ++typeParam ) {
+			for ( auto paramPair : group_iterate( baseParams, typeParams ) ) {
+				TypeDecl * baseParam = std::get<0>( paramPair );
+				Expression * typeParam = std::get<1>( paramPair );
 				// skip non-otype parameters
-				if ( ! (*baseParam)->isComplete() ) continue;
-				TypeExpr *typeExpr = dynamic_cast< TypeExpr* >( *typeParam );
+				if ( ! baseParam->isComplete() ) continue;
+				TypeExpr *typeExpr = dynamic_cast< TypeExpr* >( typeParam );
 				assert( typeExpr && "all otype parameters should be type expressions" );
 
@@ -1695,5 +1694,4 @@
 				if ( isPolyType( type ) ) hasDynamicLayout = true;
 			}
-			assert( baseParam == baseParams.end() && typeParam == typeParams.end() );
 
 			return hasDynamicLayout;
@@ -1851,10 +1849,8 @@
 					// build initializer list for offset array
 					std::list< Initializer* > inits;
-					for ( std::list< Declaration* >::const_iterator member = baseMembers.begin(); member != baseMembers.end(); ++member ) {
-						if ( DeclarationWithType *memberDecl = dynamic_cast< DeclarationWithType* >( *member ) ) {
-							inits.push_back( new SingleInit( new OffsetofExpr( ty->clone(), memberDecl ) ) );
-						} else {
-							assertf( false, "Requesting offset of Non-DWT member: %s", toString( *member ).c_str() );
-						}
+					for ( Declaration * const member : baseMembers ) {
+						DeclarationWithType *memberDecl = dynamic_cast< DeclarationWithType* >( member );
+						assertf( memberDecl, "Requesting offset of Non-DWT member: %s", toString( member ).c_str() );
+						inits.push_back( new SingleInit( new OffsetofExpr( ty->clone(), memberDecl ) ) );
 					}
 
