summaryrefslogtreecommitdiff
path: root/indra/llcommon/lldependencies.h
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2023-01-16 07:05:01 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2023-01-16 07:05:01 +0200
commitbea930071f470fb9a8d61fdd5dd8cc0deec9f95b (patch)
tree0c99e7eafdfb10463754c5645e3b5647cf7f36fa /indra/llcommon/lldependencies.h
parenta0c3d69c620a92d73a1008f218680fb4d0ef9255 (diff)
parent5d6371f568f3dcd8eb7c88a9e5d65224522528d4 (diff)
Merge branch 'contribute' into DRTVWR-577-maint-S
Diffstat (limited to 'indra/llcommon/lldependencies.h')
-rw-r--r--indra/llcommon/lldependencies.h48
1 files changed, 18 insertions, 30 deletions
diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h
index db2bbab8b0..fa54a944c8 100644
--- a/indra/llcommon/lldependencies.h
+++ b/indra/llcommon/lldependencies.h
@@ -126,7 +126,7 @@ public:
protected:
typedef std::vector< std::pair<std::size_t, std::size_t> > EdgeList;
typedef std::vector<std::size_t> VertexList;
- VertexList topo_sort(int vertices, const EdgeList& edges) const;
+ VertexList topo_sort(size_t vertices, const EdgeList& edges) const;
/**
* refpair is specifically intended to capture a pair of references. This
@@ -514,21 +514,16 @@ public:
// former broken behavior has finally been fixed -- and our builds
// treat warnings as errors.
{
- for (typename DepNodeMap::const_iterator nmi = mNodes.begin(), nmend = mNodes.end();
- nmi != nmend; ++nmi)
+ for (typename const DepNodeMap::value_type& nm_pair : mNodes)
{
- vmap.insert(typename VertexMap::value_type(nmi->first, vmap.size()));
- for (typename DepNode::dep_set::const_iterator ai = nmi->second.after.begin(),
- aend = nmi->second.after.end();
- ai != aend; ++ai)
+ vmap.insert(typename VertexMap::value_type(nm_pair.first, vmap.size()));
+ for (typename const KEY& after_k : nm_pair.second.after)
{
- vmap.insert(typename VertexMap::value_type(*ai, vmap.size()));
+ vmap.insert(typename VertexMap::value_type(after_k, vmap.size()));
}
- for (typename DepNode::dep_set::const_iterator bi = nmi->second.before.begin(),
- bend = nmi->second.before.end();
- bi != bend; ++bi)
+ for (typename const KEY& before_k : nm_pair.second.before)
{
- vmap.insert(typename VertexMap::value_type(*bi, vmap.size()));
+ vmap.insert(typename VertexMap::value_type(before_k, vmap.size()));
}
}
}
@@ -536,24 +531,19 @@ public:
// all the known key dependencies to integer pairs.
EdgeList edges;
{
- for (typename DepNodeMap::const_iterator nmi = mNodes.begin(), nmend = mNodes.end();
- nmi != nmend; ++nmi)
+ for (typename const DepNodeMap::value_type& nm_pair : mNodes)
{
- int thisnode = vmap[nmi->first];
+ auto thisnode = vmap[nm_pair.first];
// after dependencies: build edges from the named node to this one
- for (typename DepNode::dep_set::const_iterator ai = nmi->second.after.begin(),
- aend = nmi->second.after.end();
- ai != aend; ++ai)
+ for (typename const KEY& after_k : nm_pair.second.after)
{
- edges.push_back(EdgeList::value_type(vmap[*ai], thisnode));
+ edges.push_back(EdgeList::value_type(vmap[after_k], thisnode));
}
// before dependencies: build edges from this node to the
// named one
- for (typename DepNode::dep_set::const_iterator bi = nmi->second.before.begin(),
- bend = nmi->second.before.end();
- bi != bend; ++bi)
+ for (typename const KEY& before_k : nm_pair.second.before)
{
- edges.push_back(EdgeList::value_type(thisnode, vmap[*bi]));
+ edges.push_back(EdgeList::value_type(thisnode, vmap[before_k]));
}
}
}
@@ -565,21 +555,19 @@ public:
// and we're certain that the associated int values are distinct
// indexes. The fact that they're not in order is irrelevant.
KeyList vkeys(vmap.size());
- for (typename VertexMap::const_iterator vmi = vmap.begin(), vmend = vmap.end();
- vmi != vmend; ++vmi)
+ for (typename const VertexMap::value_type& vm_pair : vmap)
{
- vkeys[vmi->second] = vmi->first;
+ vkeys[vm_pair.second] = vm_pair.first;
}
// Walk the sorted output list, building the result into mCache so
// we'll have it next time someone asks.
mCache.clear();
- for (VertexList::const_iterator svi = sorted.begin(), svend = sorted.end();
- svi != svend; ++svi)
+ for (const size_t sv : sorted)
{
- // We're certain that vkeys[*svi] exists. However, there might not
+ // We're certain that vkeys[sv] exists. However, there might not
// yet be a corresponding entry in mNodes.
self_type* non_const_this(const_cast<self_type*>(this));
- typename DepNodeMap::iterator found = non_const_this->mNodes.find(vkeys[*svi]);
+ typename DepNodeMap::iterator found = non_const_this->mNodes.find(vkeys[sv]);
if (found != non_const_this->mNodes.end())
{
// Make an iterator of appropriate type.