本文整理汇总了C++中ListType::end方法的典型用法代码示例。如果您正苦于以下问题:C++ ListType::end方法的具体用法?C++ ListType::end怎么用?C++ ListType::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListType
的用法示例。
在下文中一共展示了ListType::end方法的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;
}
}
示例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());
}
}
}
示例3: addToList
void addToList(const typename ListType::value_type &data, ListType &list) const {
if (length()<=0) {
// Ensure that no dummy data will get added. Shouldn't get here.
return;
}
if (startbyte()==0 && goesToEndOfFile()) {
// favor a single chunk covering the whole file.
list.clear();
list.insert(list.end(), data);
return;
}
typename ListType::iterator endIter=list.end(), iter=list.begin();
Range::base_type startdata = startbyte();
Range::base_type maxend = startdata;
bool includeseof = false;
while (iter != endIter) {
// maxend is not relevant for ranges strictly above us.
if ((*iter).startbyte() > startdata) {
break;
}
if ((*iter).endbyte() > maxend) {
maxend = (*iter).endbyte();
}
if ((*iter).goesToEndOfFile()) {
includeseof = true;
}
// we do not want to allow for more than one
// range starting at the same start byte--
// If this is the case, one is guaranteed to overlap.
if ((*iter).startbyte() >= startdata) {
break;
}
++iter;
}
if (includeseof || (maxend > endbyte() && !goesToEndOfFile())) {
return; // already included by another range.
}
iter = list.insert(iter, data);
++iter;
while (iter != endIter) {
typename ListType::iterator nextIter = iter;
++nextIter;
if (goesToEndOfFile() ||
(!(*iter).goesToEndOfFile() && (*iter).endbyte() <= endbyte())) {
list.erase(iter);
}
iter = nextIter;
}
}
示例4: 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;
}
}
}
示例5: 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;
}
示例6: clearList
void Gear_UnpackList::clearList()
{
ListType *listType = _LIST_OUT->type();
for(ListType::iterator it=listType->begin(); it!=listType->end(); ++it)
delete (*it);
listType->clear();
}
示例7: 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);
}
}
}
示例8: 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;
}
示例9: 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() ) );
}
示例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;
}
示例11: 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;
}
示例12: 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();
}
示例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();
}
示例14: 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;
}
示例15: 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;
}