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


C++ ListType::begin方法代码示例

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


在下文中一共展示了ListType::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NormaliseFreqs

inline void HapList::NormaliseFreqs(){
  double sum = 0;
  for(ListType::iterator h = haplist.begin(); h!=haplist.end(); h++){
    sum += h->second.Freq;
  }
  for(ListType::iterator h = haplist.begin(); h!=haplist.end(); h++){
    h->second.Freq /= sum;
  }  
}
开发者ID:rafalcode,项目名称:phase,代码行数:9,代码来源:HapList2.hpp

示例2: sort

void DirectedGraph::sort() {
	for (int id = 0; id != maxNodeId + 1; id++) {
		if (hasNode(id)) {
			ListType* fromNeighbors = inNeighborsTable[id];
			ListType* toNeighbors = outNeighborsTable[id];
			std::sort(fromNeighbors->begin(), fromNeighbors->end());
			std::sort(toNeighbors->begin(), toNeighbors->end());
		}
	}
}
开发者ID:supergao222,项目名称:compression,代码行数:10,代码来源:DirectedGraph.cpp

示例3: NormaliseGroupFreqs

inline void HapList::NormaliseGroupFreqs(){
  
  for(unsigned g=0; g< haplist.begin()->second.GroupFreq.size(); g++){
    double norm = 0;
    for(ListType::iterator h = haplist.begin(); h!=haplist.end(); h++)
      norm += h->second.GroupFreq[g];
    for(ListType::iterator h = haplist.begin(); h!=haplist.end(); h++){
      h->second.GroupFreq[g] /= norm;
      h->second.GroupFreqSq[g] /= norm;
    }
  }
    
}
开发者ID:rafalcode,项目名称:phase,代码行数:13,代码来源:HapList2.hpp

示例4: set

void TasksProperty::set(const Atlas::Message::Element & val)
{
    if (!val.isList())
    {
        log(ERROR, "Task property must be a list.");
        return;
    }

    if (m_task == 0) {
        log(ERROR, "No task in ::set");
        return;
    }

    ListType tasks = val.asList();
    ListType::const_iterator I = tasks.begin();
    ListType::const_iterator Iend = tasks.end();
    for (; I != Iend; ++I) {
        if (!I->isMap()) {
            log(ERROR, "Task must be a map.");
            return;
        }
        const MapType & task = I->asMap();
        MapType::const_iterator J = task.begin();
        MapType::const_iterator Jend = task.end();
        for (J = task.begin(); J != Jend; ++J) {
            m_task->setAttr(J->first, J->second);
        }
    }
}
开发者ID:9cat,项目名称:cyphesis,代码行数:29,代码来源:TasksProperty.cpp

示例5: randomFragment

inline typename ListType::Iterator randomFragment(const ListType& src)
{
    if( src.empty() ) return src.end();
    typename ListType::ConstIterator result = src.begin();
    ::std::advance( result, ::std::rand() % src.size() );
    return result;
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:7,代码来源:List.hpp

示例6: mostWeightFrom

int Linearization::mostWeightFrom(std::list<int> *X)
{
	int maxWeight = 0;
	int result = -1;
	std::map<int, double> weightTable;
	
	for (std::list<int>::iterator nodeInX = X->begin(); nodeInX != X->end();
			nodeInX++) {
		ListType* nodesNeighbors = undirectedGraph->getNeighborByNodeId(*nodeInX);
		for (ListType::iterator neighbor = nodesNeighbors->begin();
				neighbor != nodesNeighbors->end(); neighbor++) {
			if (std::find(X->begin(), X->end(), *neighbor) != X->end())
				continue;
			if (weightTable.find(*neighbor) == weightTable.end())
				weightTable[*neighbor] = 0;
			weightTable[*neighbor]++;
		}
	}
	for (std::map<int, double>::iterator i = weightTable.begin(); i != weightTable.end(); i++) {
		if (i->second > maxWeight) {
			result = i->first;
			maxWeight = i->second;
		}
	}
	return result;
}
开发者ID:supergao222,项目名称:compression,代码行数:26,代码来源:Linearization.cpp

示例7: clearList

void Gear_UnpackList::clearList()
{
  ListType *listType = _LIST_OUT->type();
  for(ListType::iterator it=listType->begin(); it!=listType->end(); ++it)
    delete (*it);
  listType->clear();
}
开发者ID:sofian,项目名称:drone,代码行数:7,代码来源:Gear_UnpackList.cpp

示例8: FragmentType

typename ListType::FragmentType
selectBlock(const ListType& src, typename ListType::FSizeType blockSize,
    const AvailableType* available )
{
    typedef typename ListType::FragmentType FragmentType;
    typedef typename ListType::FSizeType FSizeType;
    typedef typename ListType::ConstIterator ConstIterator;
    
    if( src.empty() ) return FragmentType( 0,
        ::std::numeric_limits< FSizeType >::max() );

    ::std::deque< FSizeType > blocks;

    for( ConstIterator selectIterator = src.begin();
        selectIterator != src.end(); ++selectIterator )
    {
        FSizeType blockBegin = selectIterator->begin() / blockSize;
        FSizeType blockEnd = ( selectIterator->end() - 1 ) / blockSize;
		if ( selectIterator->begin() % blockSize )
		{
			// the start of a block is complete, but part is missing
			
			if ( !available || available[ blockBegin ] )
			{
                return FragmentType( selectIterator->begin(),
                    ::std::min( selectIterator->end(),
                    blockSize * ( blockBegin + 1 ) ) );
			}
            ++blockBegin;
		}
		if ( blockBegin <= blockEnd && selectIterator->end() % blockSize
            && selectIterator->end() < src.limit() )
		{
			// the end of a block is complete, but part is missing
			
			if ( !available || available[ blockEnd ] )
			{
                return FragmentType( blockEnd * blockSize,
                    selectIterator->end() );
			}
            --blockEnd;
		}
		// this fragment contains one or more aligned empty blocks
        if( blockEnd != ~0ULL ) for( ; blockBegin <= blockEnd; ++blockBegin )
        {
            if( !available || available[ blockBegin ] )
            {
                blocks.push_back( blockBegin );
            }
        }
	}
	
    if( blocks.empty() )  return FragmentType( 0,
        ::std::numeric_limits< FSizeType >::max() );

    FSizeType blockBegin = blocks[ ::std::rand() % blocks.size() ] * blockSize;

    return FragmentType( blockBegin, ::std::min( blockBegin + blockSize, src.limit() ) );
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:59,代码来源:Compatibility.hpp

示例9: largestFragment

inline typename ListType::ConstIterator largestFragment(const ListType& src)
{
    typedef typename ListType::ConstIterator ConstIterator;
    ConstIterator result = src.begin();
    for( ConstIterator i = result; i != src.end(); ++i )
        if( result->length() < i->length() ) result = i;
    return result;
}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:8,代码来源:List.hpp

示例10: removeEdge

bool DirectedGraph::removeEdge(int fromNodeId, int toNodeId) {
	ListType::iterator neighborToRemove;
	ListType* fromNeighbors = inNeighborsTable[toNodeId];
	
	neighborToRemove = std::lower_bound(fromNeighbors->begin(), fromNeighbors->end(), fromNodeId);
	if (neighborToRemove != fromNeighbors->end() && (*neighborToRemove == fromNodeId))
		fromNeighbors->erase(neighborToRemove);
	else
		return false;
	
	ListType* toNeighbors = outNeighborsTable[fromNodeId];
	neighborToRemove = std::lower_bound(toNeighbors->begin(), toNeighbors->end(), toNodeId);
	assert(*neighborToRemove == toNodeId);
	toNeighbors->erase(neighborToRemove);
	edgeCount--;
	return true;
}
开发者ID:supergao222,项目名称:compression,代码行数:17,代码来源:DirectedGraph.cpp

示例11: listElementListItem

void Encoder::listElementListItem(const ListType& obj)
{
    m_b.listListItem();
    ListType::const_iterator I;
    for (I = obj.begin(); I != obj.end(); I++) {
        listElementItem(*I);
    }
    m_b.listEnd();    
}
开发者ID:bregma,项目名称:atlas-cpp,代码行数:9,代码来源:MEncoder.cpp

示例12: get_haplotype

inline Haplotype HapList::get_haplotype(int listpos){
  int pos = 0;
  ListType::const_iterator h = haplist.begin();
  while(pos<listpos){
    h++;
    pos++;
  }
  return (*h).first;
}
开发者ID:rafalcode,项目名称:phase,代码行数:9,代码来源:HapList2.hpp

示例13: mapElementListItem

void Encoder::mapElementListItem(const std::string& name, const ListType& obj)
{
    m_b.mapListItem(name);
    ListType::const_iterator I;
    for (I = obj.begin(); I != obj.end(); I++) {
        listElementItem(*I);
    }
    m_b.listEnd();
}
开发者ID:bregma,项目名称:atlas-cpp,代码行数:9,代码来源:MEncoder.cpp

示例14: convertToUndirectedGraph

UndirectedGraph* DirectedGraph::convertToUndirectedGraph() {
	UndirectedGraph* result = new UndirectedGraph(maxNodeId);
	for (int i = 0; i != maxNodeId + 1; i++) {
		if (!hasNode(i))
			continue;
		ListType* neighborsList = inNeighborsTable[i];
		for (ListType::iterator neighbor = neighborsList->begin();
				neighbor != neighborsList->end(); neighbor++) {
			result->addEdge(*neighbor, i);
		}
		neighborsList = outNeighborsTable[i];
		for (ListType::iterator neighbor = neighborsList->begin();
				neighbor != neighborsList->end(); neighbor++) {
			result->addEdge(*neighbor, i);
		}
	}
	result->sort();
	return result;
}
开发者ID:supergao222,项目名称:compression,代码行数:19,代码来源:DirectedGraph.cpp

示例15: operator

 inline AtomType operator()( ListType const &  arg ) const
 {
     AtomType ar;
     typedef typename ListType::const_iterator IT;
     IT it = arg.begin();
     for( ; arg.end() != it; ++it ) {
         ar.push( nativeToAtom(*it) );
     }
     return ar;
 }
开发者ID:alseambusher,项目名称:Easy-Multi-Player,代码行数:10,代码来源:nosjob_convert.hpp


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