当前位置: 首页>>代码示例>>C++>>正文


C++ EMap::end方法代码示例

本文整理汇总了C++中EMap::end方法的典型用法代码示例。如果您正苦于以下问题:C++ EMap::end方法的具体用法?C++ EMap::end怎么用?C++ EMap::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EMap的用法示例。


在下文中一共展示了EMap::end方法的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;
	}
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:30,代码来源:CEditEffectGroup.cpp

示例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;
 }
开发者ID:CrAzYPiLoT-SS13,项目名称:Cataclysm-DDA,代码行数:9,代码来源:catalua.cpp

示例3: index

 static int index( lua_State * const L )
 {
     // -1 is the key (funtion to call)
     const char * const key = lua_tostring( L, -1 );
     if( key == nullptr ) {
         luaL_error( L, "Invalid input to __index: key is not a string." );
     }
     const auto iter = BINDINGS.find( key );
     if( iter == BINDINGS.end() ) {
         return luaL_error( L, "Invalid enum value." );
     }
     lua_remove( L, -1 ); // remove key
     // Push the enum as string, it will be converted back to the enum later. This way, it can
     // be specified both ways in Lua code: either as string or via an entry here.
     lua_pushlstring( L, iter->first.c_str(), iter->first.length() );
     return 1;
 }
开发者ID:CrAzYPiLoT-SS13,项目名称:Cataclysm-DDA,代码行数:17,代码来源:catalua.cpp

示例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();
    }
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:82,代码来源:Wm5ExtractCurveTris.cpp


注:本文中的EMap::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。