本文整理汇总了C++中EMap::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ EMap::begin方法的具体用法?C++ EMap::begin怎么用?C++ EMap::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EMap
的用法示例。
在下文中一共展示了EMap::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CEditEffectGroup::ReNameGroup(string strOld,string strNew)
{
EMap< EString, CEffectProp* >::iterator iter = m_EffectProps.begin();
EMap< EString, CEffectProp* > mapTemp;
EString strTemp = strOld.c_str();
strTemp = strTemp + "\\";
EString strReplace = strNew.c_str();
strReplace = strReplace + "\\";
for (;iter != m_EffectProps.end();)
{
EString str = iter->first.c_str();
int pos = str.find(strTemp);
if (pos != -1)
{
int linePos = str.find("\\");
linePos+=1;
str = str.substr(linePos,str.size()-linePos);
str.insert(pos,strReplace);
mapTemp.insert(make_pair(str,iter->second));
m_EffectProps.erase(iter++);
continue;
}
else
iter++;
}
for (EMap< EString, CEffectProp* >::iterator iter = mapTemp.begin();iter != mapTemp.end();++iter)
{
m_EffectProps[iter->first] = iter->second;
}
}
示例2: from_string
static E from_string( const std::string &value )
{
const auto iter = BINDINGS.find( value );
if( iter == BINDINGS.end() ) {
// This point shall not be reached. Always call this with valid input.
return BINDINGS.begin()->second;
}
return iter->second;
}
示例3:
static const std::string &to_string( E const value )
{
for( auto & e : BINDINGS ) {
if( e.second == value ) {
return e.first;
}
}
// This point shall not be reached. Always call this with valid input.
return BINDINGS.begin()->first;
}
示例4: MakeUnique
//----------------------------------------------------------------------------
void ExtractCurveTris::MakeUnique (std::vector<Vector2f>& vertices,
std::vector<EdgeKey>& edges)
{
int numVertices = (int)vertices.size();
if (numVertices == 0)
{
return;
}
// Use maps to generate unique storage.
typedef std::map<Vector2f, int> VMap;
typedef std::map<Vector2f, int>::iterator VIterator;
VMap vertexMap;
for (int v = 0, nextVertex = 0; v < numVertices; ++v)
{
std::pair<VIterator, bool> result = vertexMap.insert(
std::make_pair(vertices[v], nextVertex));
if (result.second == true)
{
++nextVertex;
}
}
typedef std::map<EdgeKey, int> EMap;
typedef std::map<EdgeKey, int>::iterator EIterator;
EMap* edgeMap = 0;
int e;
VIterator vIter;
int numEdges = (int)edges.size();
if (numEdges)
{
edgeMap = new0 EMap();
int nextEdge = 0;
for (e = 0; e < numEdges; ++e)
{
// Replace old vertex indices by new ones.
vIter = vertexMap.find(vertices[edges[e].V[0]]);
assertion(vIter != vertexMap.end(), "Unexpected condition\n");
edges[e].V[0] = vIter->second;
vIter = vertexMap.find(vertices[edges[e].V[1]]);
assertion(vIter != vertexMap.end(), "Unexpected condition\n");
edges[e].V[1] = vIter->second;
// Keep only unique edges.
std::pair<EIterator, bool> result = edgeMap->insert(
std::make_pair(edges[e], nextEdge));
if (result.second == true)
{
++nextEdge;
}
}
}
// Pack the vertices into an array.
numVertices = (int)vertexMap.size();
vertices.resize(numVertices);
for (vIter = vertexMap.begin(); vIter != vertexMap.end(); ++vIter)
{
vertices[vIter->second] = vIter->first;
}
// Pack the edges into an array.
if (numEdges > 0)
{
numEdges = (int)edgeMap->size();
edges.resize(numEdges);
EIterator eIter;
for (eIter = edgeMap->begin(); eIter != edgeMap->end(); ++eIter)
{
edges[eIter->second] = eIter->first;
}
delete0(edgeMap);
}
else
{
edges.clear();
}
}