本文整理汇总了C++中SList::pushFront方法的典型用法代码示例。如果您正苦于以下问题:C++ SList::pushFront方法的具体用法?C++ SList::pushFront怎么用?C++ SList::pushFront使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SList
的用法示例。
在下文中一共展示了SList::pushFront方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void){
SList<int> mylist;
mylist.pushFront(10);
mylist.pushFront(20);
mylist.pushBack(30);
for(auto it=mylist.begin();it!=mylist.end();++it){
cout << *it << endl;
}
return 0;
}
示例2: findWeightedShortestPath
void FixEdgeInserterCore::findWeightedShortestPath(const CombinatorialEmbedding &E, edge eOrig, SList<adjEntry> &crossed)
{
node s = m_pr.copy(eOrig->source());
node t = m_pr.copy(eOrig->target());
OGDF_ASSERT(s != t);
int eSubgraph = (m_pSubgraph != nullptr) ? (*m_pSubgraph)[eOrig] : 0;
EdgeArray<int> costDual(m_dual, 0);
int maxCost = 0;
for(edge eDual : m_dual.edges) {
int c = getCost(m_primalAdj[eDual]->theEdge(), eSubgraph);
costDual[eDual] = c;
if (c > maxCost)
maxCost = c;
}
++maxCost;
Array<SListPure<edge> > nodesAtDist(maxCost);
NodeArray<edge> spPred(m_dual,nullptr);
int oldIdCount = m_dual.maxEdgeIndex();
// augment dual by edges from s to all adjacent faces of s ...
for(adjEntry adj : s->adjEdges) {
// starting edges of bfs-search are all edges leaving s
edge eDual = m_dual.newEdge(m_vS, m_nodeOf[E.rightFace(adj)]);
m_primalAdj[eDual] = adj;
nodesAtDist[0].pushBack(eDual);
}
// ... and from all adjacent faces of t to t
for(adjEntry adj : t->adjEdges) {
edge eDual = m_dual.newEdge(m_nodeOf[E.rightFace(adj)], m_vT);
m_primalAdj[eDual] = adj;
}
// actual search (using extended bfs on directed dual)
int currentDist = 0;
for( ; ; )
{
// next candidate edge
while(nodesAtDist[currentDist % maxCost].empty())
++currentDist;
edge eCand = nodesAtDist[currentDist % maxCost].popFrontRet();
node v = eCand->target();
// leads to an unvisited node?
if (spPred[v] == nullptr)
{
// yes, then we set v's predecessor in search tree
spPred[v] = eCand;
// have we reached t ...
if (v == m_vT)
{
// ... then search is done.
// constructed list of used edges (translated to crossed
// adjacency entries in PG) from t back to s (including first
// and last!)
do {
edge eDual = spPred[v];
crossed.pushFront(m_primalAdj[eDual]);
v = eDual->source();
} while(v != m_vS);
break;
}
// append next candidate edges to queue (all edges leaving v)
appendCandidates(nodesAtDist, costDual, maxCost, v, currentDist);
}
}
// remove augmented edges again
adjEntry adj;
while ((adj = m_vS->firstAdj()) != nullptr)
m_dual.delEdge(adj->theEdge());
while ((adj = m_vT->firstAdj()) != nullptr)
m_dual.delEdge(adj->theEdge());
m_dual.resetEdgeIdCount(oldIdCount);
}
示例3: findShortestPath
void FixEdgeInserterCore::findShortestPath(const CombinatorialEmbedding &E, edge eOrig, SList<adjEntry> &crossed)
{
node s = m_pr.copy(eOrig->source());
node t = m_pr.copy(eOrig->target());
OGDF_ASSERT(s != t);
NodeArray<edge> spPred(m_dual,nullptr);
QueuePure<edge> queue;
int oldIdCount = m_dual.maxEdgeIndex();
// augment dual by edges from s to all adjacent faces of s ...
for(adjEntry adj : s->adjEdges) {
// starting edges of bfs-search are all edges leaving s
edge eDual = m_dual.newEdge(m_vS, m_nodeOf[E.rightFace(adj)]);
m_primalAdj[eDual] = adj;
queue.append(eDual);
}
// ... and from all adjacent faces of t to t
for(adjEntry adj : t->adjEdges) {
edge eDual = m_dual.newEdge(m_nodeOf[E.rightFace(adj)], m_vT);
m_primalAdj[eDual] = adj;
}
// actual search (using bfs on directed dual)
for( ; ;)
{
// next candidate edge
edge eCand = queue.pop();
node v = eCand->target();
// leads to an unvisited node?
if (spPred[v] == nullptr)
{
// yes, then we set v's predecessor in search tree
spPred[v] = eCand;
// have we reached t ...
if (v == m_vT)
{
// ... then search is done.
// constructed list of used edges (translated to crossed
// adjacency entries in PG) from t back to s (including first
// and last!)
do {
edge eDual = spPred[v];
crossed.pushFront(m_primalAdj[eDual]);
v = eDual->source();
} while(v != m_vS);
break;
}
// append next candidate edges to queue (all edges leaving v)
appendCandidates(queue, v);
}
}
// remove augmented edges again
adjEntry adj;
while ((adj = m_vS->firstAdj()) != nullptr)
m_dual.delEdge(adj->theEdge());
while ((adj = m_vT->firstAdj()) != nullptr)
m_dual.delEdge(adj->theEdge());
m_dual.resetEdgeIdCount(oldIdCount);
}