本文整理汇总了C++中Items::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Items::end方法的具体用法?C++ Items::end怎么用?C++ Items::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Items
的用法示例。
在下文中一共展示了Items::end方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lhsString
int
Bchart::
headPosFromItems(Item* lhs, Items& rhs)
{
int ansPriority = 9999;
ECString lhsString(lhs->term()->name());
if(lhsString == "") lhsString = "S1";
int pos = -1;
int ans = -1;
Items::iterator ii = rhs.begin();
Item *subi;
for( ; ii != rhs.end() ; ii++ )
{
subi = (*ii);
pos++;
const Term* trm = subi->term();
int nextPriority = 12;
if(trm)
{
ECString rhsString(subi->term()->name());
if(subi->term() == Term::stopTerm) continue;
nextPriority = headPriority(lhsString, rhsString, ansPriority);
}
if(nextPriority <= ansPriority)
{
ans = pos;
ansPriority = nextPriority;
}
}
return ans;
}
示例2: WriteItems
QStringList ShopTemplateManager::WriteItems(const Items &items, bool includeBuyoutTag, bool includeNoBuyouts) {
Items sorted = items;
QStringList result;
// Sort to ensure that the template matches even if the item order is different.
std::sort(sorted.begin(), sorted.end(), [](const std::shared_ptr<Item> &first, const std::shared_ptr<Item> &second) -> bool {
return first->PrettyName() > second->PrettyName();
});
for (auto &item : sorted) {
if (item->location().socketed())
continue;
if (parent_->buyout_manager().Exists(*item)) {
Buyout bo = parent_->buyout_manager().Get(*item);
QString temp = QString::fromStdString(item->location().GetForumCode(parent_->league()));
if (includeBuyoutTag)
temp += BuyoutManager::Generate(bo);
result << temp;
}
else if (includeNoBuyouts) {
result << QString::fromStdString(item->location().GetForumCode(parent_->league()));
}
}
return result;
}
示例3:
Item *
ChartBase::
get_S() const
{
const Term * sterm = Term::rootTerm;
Item *itm;
Items il = regs[wrd_count_ - 1][0];
Items::iterator ili = il.begin();
for(; ili != il.end(); ili++ )
{
itm = *ili;
if( itm->term() == sterm )
return itm;
}
return NULL;
}
示例4: saveItems
void Persist::saveItems(Items& library)
{
Items::iterator iterator;
const char* fileName = Library::FILE_NAME.c_str();
std::ofstream file(fileName, std::ios::out);
if (!file)
{
std::cerr << "Error while opening " << fileName << std::endl;
exit(EXIT_FAILURE);
}
for (iterator = library.begin(); iterator != library.end(); ++iterator)
{
Item item = (*iterator).second;
file.write(reinterpret_cast<const char*>(&item), sizeof(Item));
}
file.close();
}
示例5: get_items_at
void get_items_at(const Rectf& rect, std::vector<C>& out_items) const
{
// If rect overlaps with the given quadrant, recursivly check the quadrant
if (m_nw.get() &&
rect.left < m_center.x &&
rect.top < m_center.y)
{
m_nw->get_items_at(rect, out_items);
}
if (m_ne.get() &&
rect.right > m_center.x &&
rect.top < m_center.y)
{
m_ne->get_items_at(rect, out_items);
}
if (m_sw.get() &&
rect.left < m_center.x &&
rect.bottom > m_center.y)
{
m_sw->get_items_at(rect, out_items);
}
if (m_se.get() &&
rect.right > m_center.x &&
rect.bottom > m_center.y)
{
m_se->get_items_at(rect, out_items);
}
// Check all overlapping items
for(typename Items::const_iterator i = m_items.begin(); i != m_items.end(); ++i)
{
if (i->rect.is_overlapped(rect))
{
out_items.push_back(i->data);
}
}
}
示例6: processPersistentRequests
void Client::processPersistentRequests(_Store& store)
{
// create a typedef for the vector holding the correct type of items
typedef std::vector<typename _Store::Item> Items;
// get the items that need to be reconstructed
Items items = store.getBadItems();
if (items.size() > 0)
logger_->debug("A total of %d persistent requests need to be re-processed",
items.size());
// loop through the items and process them
// (We don't have to care about the Status result of the processRequest function,
// since processPersistentRequests() is called automatically by a thread, and this
// thread doesn't perform any actions in case of failures.)
for (typename Items::iterator it = items.begin(); it != items.end(); ++it)
processRequest<typename _Store::ServiceType>(
it->request,
it->badTargetsMask,
it->result);
}
示例7: UpdateChunk
void Space::UpdateChunk( Vec2i index, float dt )
{
// The chunk we're at
Chunks::iterator it = chunks.find( index );
if( it != chunks.end() ) {
Chunk &chunk = it->second;
// Update our chunk and everything in it
chunk.Update( dt );
// Check intersections
Items items = chunk.GetItems();
for( Items::iterator it = items.begin(); it != items.end(); ++it ) {
if( (*it)->BoundingBox().Intersects( satellite.BoundingBox() ) ) {
Intersects( *it );
}
}
}
else {
//L_("couldn't find %d index chunk for updating\n");
}
}
示例8: generic_worker_single_thr
//.........这里部分代码省略.........
s.contig = search->contig_conversion.convert(s.contig);
}
printable_solutions.push_back(s);
} else { // printALL
*/
/*
unsigned int processed=0;
unsigned int alignments;
(search->toBePrinted < solutions_gapped.size()) ? alignments = search->toBePrinted : alignments = solutions_gapped.size() ;
while(processed < alignments) {
const ResultItemGapped & HM = solutions_gapped.at(processed);
s.globalPosition = HM.GlobalPosition1;
s.algn = alignments;
s.HI =1;
s.IH =1;
(processed == 0 ) ? s.primary = true : s.primary = false;
s.strand = HM.strand;
s.NM = HM.errors1;
s.NM_gap = HM.errors2;
s.contig = HM.contig ;
s.position = HM.GlobalPosition1 - search->H.globaltolocal.startPositions[HM.contig] + 1 ;
s.position_gap = HM.GlobalPosition2 - search->H.globaltolocal.startPositions[HM.contig] + 1 ;
s.length1_gap = HM.length1;
s.length2_gap = HM.length2;
s.contaminated = contaminated;
printable_solutions.push_back(s);
processed++;
}
*/
/*
ERROR_CHANNEL << "--print-all option not implemented yet!" << endl;
exit(3);
}
}
*/
} else if (not search->printAll) {
sort(solutions.begin(), solutions.end(), ResultItem::less()); // sort solutions
solutions.erase(unique(solutions.begin(), solutions.end(), ResultItem::equal()), solutions.end());
Random_Choice_Result r;
bool improved = (s.NM + s.NM_gap) > (solutions.at(0).errors);
if (improved)
r = Module_DMAP::random_choice_from_previous(0,solutions.size());
else {
r = Module_DMAP::random_choice_from_previous(s.algn,solutions.size());
s.algn += solutions.size();
}
if (not r.first) {
const ResultItem & HM = solutions.at(r.second);
s.HI = 1;
s.IH = 1;
s.primary = true;
s.globalPosition = HM.globalPosition;
s.strand = HM.strand;
s.NM = HM.errors;
s.NM_gap = 0;
if ((search->my_rank == 0) and s.contaminated) {
s.contig = search->CR.globalToLocal.searchContig(HM.globalPosition); // find the contig/scaffold
s.position = HM.globalPosition - search->CR.globalToLocal.startPositions[s.contig] + 1;
s.contig = search->contig_conversion.convert(s.contig);
} else {
s.contig = search->H.globalToLocal.searchContig(HM.globalPosition); // find the contig/scaffold
示例9: nmi
void
ChartBase::
set_Alphas()
{
Item *snode = get_S();
double tempAlpha[400]; //400 has no particular meaning, just large enough.
if( !snode || snode->prob() == 0.0 )
{
warn( "estimating the counts on a zero-probability sentence" );
return;
}
double sAlpha = 1.0/snode->prob();
snode->poutside() = sAlpha;
/* for each position in the 2D chart, starting at top*/
/* look at every bucket of length j */
for (int j = wrd_count_-1 ; j >= 0 ; j--)
{
for (int i = 0 ; i <= wrd_count_ - j ; i++)
{
Items il = regs[j][i];
list<Item*>::iterator ili = il.begin();
Item* itm;
for(; ili != il.end(); ili++ )
{
itm = *ili;
if(itm != snode) itm->poutside() = 0; //init outside probs to 0;
}
bool valuesChanging = true;
/* do alpha calulcations until values settle down */
ili = il.begin();
while(valuesChanging)
{
valuesChanging = false;
int tempPos = 0; //position in tempAlpha;
ili = il.begin();
for(; ili != il.end(); ili++ )
{
itm = *ili;
if(itm == snode) continue;
double itmalpha = 0;
NeedmeIter nmi(itm);
Edge* e;
while( nmi.next(e) )
{
const Item* lhsItem = e->finishedParent();
if(lhsItem) itmalpha += lhsItem->poutside()
* e->prob();
}
assert(tempPos < 400);
double val = itmalpha/itm->prob();
tempAlpha[tempPos++] = val;
}
/* at this point the new alpha values are stored in tempAlpha */
int temppos = 0;
ili = il.begin();
for(; ili != il.end(); ili++ )
{
itm = *ili;
if(itm == snode) continue;
/* the start symbol for the entire sentence has poutside =1*/
if(i == 0 && j ==wrd_count_-1 &&
itm->term()->name() == "S1")
itm->poutside() = sAlpha;
else
{
double oOutside = itm->poutside();
double nOutside = tempAlpha[temppos];
if(nOutside == 0)
{
if(oOutside != 0) error("Alpha went down");
}
else if(oOutside/nOutside < .95)
{
itm->poutside() = nOutside;
valuesChanging = true;
//cerr << "alpha*beta " << *itm << " = "
//<< (itm->poutside() * itm->prob()) << endl;
}
}
temppos++;
}
if(temppos != tempPos)
{
cerr << "temppos = " << temppos << " and tempPos = "
<< tempPos << " ";
error("Funnly situation in setAlphas");
}
}
}
}
}
示例10: addItems
// adds all items in the Items vector
void PopupMenu::addItems( Items& in, Items& items )
{
for( PopupMenu::Items::iterator i = items.begin();
i != items.end(); ++i )
in.push_back( *i );
}