本文整理汇总了C++中SList::front方法的典型用法代码示例。如果您正苦于以下问题:C++ SList::front方法的具体用法?C++ SList::front怎么用?C++ SList::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SList
的用法示例。
在下文中一共展示了SList::front方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void SwapTwoLists::run()
{
SList newList;
SList otherList;
std::string str1 = "foo";
std::string str2 = "bar";
std::string str3 = "baz";
std::string str4 = "far";
std::string str5 = "faz";
newList.push_front(str1);
newList.push_front(str2);
newList.push_front(str3);
otherList.push_front(str4);
otherList.push_front(str5);
newList.swap(otherList);
checkEquals(newList.front(), str5);
newList.pop_front();
checkEquals(newList.front(), str4);
checkEquals(otherList.front(), str3);
otherList.pop_front();
checkEquals(otherList.front(), str2);
otherList.pop_front();
checkEquals(otherList.front(), str1);
}
示例2: doCall
//.........这里部分代码省略.........
for(edge eee : GA_UPR_tmp.constGraph().edges) {
DPolyline &line = GA_UPR_tmp.bends(eee);
ListIterator<DPoint> it;
for(it = line.begin(); it.valid(); it++) {
(*it).m_y = -(*it).m_y;
(*it).m_x = -(*it).m_x;
}
}
GA_UPR_tmp.writeGML("c:/temp/UPR_tmp_fups.gml");
cout << "UPR_tmp/fups faces:";
UPR_tmp.outputFaces(UPR_tmp.getEmbedding());
//end -----------------------------------------------debug
}
*/
delEdges.permute();
m_inserter.get().call(UPR_tmp, cost_Block, delEdges);
if (i != 0) {
if (UPR_tmp.numberOfCrossings() < bestUPR.numberOfCrossings()) {
//cout << endl << "new cr_nr:" << UPR_tmp.numberOfCrossings() << " old cr_nr : " << bestUPR.numberOfCrossings() << endl;
bestUPR = UPR_tmp;
}
}
else
bestUPR = UPR_tmp;
}//for
}
else { //block is upward planar
CombinatorialEmbedding Gamma(block);
FaceSinkGraph fsg((const CombinatorialEmbedding &) Gamma, s_block);
SList<face> faceList;
fsg.possibleExternalFaces(faceList);
Gamma.setExternalFace(faceList.front());
UpwardPlanRep UPR_tmp(Gamma);
UPR_tmp.augment();
//mark the source arcs of block
UPR_tmp.m_isSourceArc[UPR_tmp.copy(s->firstAdj()->theEdge())] = true;
for (adjEntry adj_tmp : UPR_tmp.copy(s->firstAdj()->theEdge()->target())->adjEntries) {
edge e_tmp = UPR_tmp.original(adj_tmp->theEdge());
if (e_tmp != nullptr && block.original(e_tmp) != nullptr && sourceArcs[block.original(e_tmp)])
UPR_tmp.m_isSourceArc[adj_tmp->theEdge()] = true;
}
bestUPR = UPR_tmp;
/*
//debug
//---------------------------------------------------debug
GraphAttributes GA_UPR_tmp(UPR_tmp, GraphAttributes::nodeGraphics|
GraphAttributes::edgeGraphics|
GraphAttributes::nodeColor|
GraphAttributes::edgeColor|
GraphAttributes::nodeLabel|
GraphAttributes::edgeLabel
);
GA_UPR_tmp.setAllHeight(30.0);
GA_UPR_tmp.setAllWidth(30.0);
// label the nodes with their index
for(node z : GA_UPR_tmp.constGraph().nodes) {
GA_UPR_tmp.label(z) = to_string(z->index());
GA_UPR_tmp.y(z)=-GA_UPR_tmp.y(z);
GA_UPR_tmp.x(z)=-GA_UPR_tmp.x(z);
示例3: insertEdgePathEmbedded
void UpwardPlanRep::insertEdgePathEmbedded(edge eOrig, SList<adjEntry> crossedEdges, EdgeArray<int> &costOrig)
{
removeSinkArcs(crossedEdges);
//case the copy v of eOrig->source() is a sink switch
//we muss remove the sink arcs incident to v, since after inserting eOrig, v is not a sink witch
node v = crossedEdges.front()->theNode();
List<edge> outEdges;
if (v->outdeg() == 1)
v->outEdges(outEdges); // we delete these edges later
m_eCopy[eOrig].clear();
adjEntry adjSrc, adjTgt;
SListConstIterator<adjEntry> it = crossedEdges.begin();
// iterate over all adjacency entries in crossedEdges except for first
// and last
adjSrc = *it;
List<adjEntry> dirtyList; // left and right face of the element of this list are modified
for(++it; it.valid() && it.succ().valid(); ++it)
{
adjEntry adj = *it;
bool isASourceArc = false, isASinkArc = false;
if (m_isSinkArc[adj->theEdge()])
isASinkArc = true;
if (m_isSourceArc[adj->theEdge()])
isASourceArc = true;
int c = 0;
if (original(adj->theEdge()) != nullptr)
c = costOrig[original(adj->theEdge())];
// split edge
node u = m_Gamma.split(adj->theEdge())->source();
if (!m_isSinkArc[adj->theEdge()] && !m_isSourceArc[adj->theEdge()])
crossings = crossings + c; // crossing sink/source arcs cost nothing
// determine target adjacency entry and source adjacency entry
// in the next iteration step
adjTgt = u->firstAdj();
adjEntry adjSrcNext = adjTgt->succ();
if (adjTgt != adj->twin())
std::swap(adjTgt, adjSrcNext);
edge e_split = adjTgt->theEdge(); // the new split edge
if (e_split->source() != u)
e_split = adjSrcNext->theEdge();
if (isASinkArc)
m_isSinkArc[e_split] = true;
if (isASourceArc)
m_isSourceArc[e_split] = true;
// insert a new edge into the face
edge eNew = m_Gamma.splitFace(adjSrc,adjTgt);
m_eIterator[eNew] = GraphCopy::m_eCopy[eOrig].pushBack(eNew);
m_eOrig[eNew] = eOrig;
dirtyList.pushBack(eNew->adjSource());
adjSrc = adjSrcNext;
}
// insert last edge
edge eNew = m_Gamma.splitFace(adjSrc,*it);
m_eIterator[eNew] = m_eCopy[eOrig].pushBack(eNew);
m_eOrig[eNew] = eOrig;
dirtyList.pushBack(eNew->adjSource());
// remove the sink arc incident to v
if(!outEdges.empty()) {
edge e = outEdges.popFrontRet();
if (m_isSinkArc[e])
m_Gamma.joinFaces(e);
}
m_Gamma.setExternalFace(m_Gamma.rightFace(extFaceHandle));
//computeSinkSwitches();
FaceSinkGraph fsg(m_Gamma, s_hat);
List<adjEntry> dummyList;
FaceArray< List<adjEntry> > sinkSwitches(m_Gamma, dummyList);
fsg.sinkSwitches(sinkSwitches);
//construct sinkArc for the dirty faces
for(adjEntry adj : dirtyList) {
face fLeft = m_Gamma.leftFace(adj);
face fRight = m_Gamma.rightFace(adj);
List<adjEntry> switches = sinkSwitches[fLeft];
OGDF_ASSERT(!switches.empty());
constructSinkArcs(fLeft, switches.front()->theNode());
OGDF_ASSERT(!switches.empty());
switches = sinkSwitches[fRight];
constructSinkArcs(fRight, switches.front()->theNode());
//.........这里部分代码省略.........