本文整理汇总了C++中tuple::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ tuple::begin方法的具体用法?C++ tuple::begin怎么用?C++ tuple::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tuple
的用法示例。
在下文中一共展示了tuple::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addT
bool FixedTupleListAdress::addT(tuple pids) {
bool returnVal = true;
System& system = storage->getSystemRef();
esutil::Error err(system.comm);
// ADD THE LOCAL PARTICLES (pointers)
Particle* vp, *at;
std::vector<Particle*> tmp; // temporary vector
std::vector<longint> pidstmp; // temporary vector
longint pidK; // the pid used as key
tuple::iterator it = pids.begin();
vp = storage->lookupRealParticle(*it);
if (!vp) { // Particle does not exist here, return false
//std::cout << "particle " << *it << " not found in localParticles \n";
returnVal = false;
}
else{
pidK = *it; // first pid is key
//std::cout << "Add key: " << *it << "\n";
for (++it; it != pids.end(); ++it) {
at = storage->lookupAdrATParticle(*it);
if (!at) { // Particle does not exist here, return false
std::stringstream msg;
msg << "ERROR: AT particle " << *it << " not found in localAdrATParticles \n";
err.setException( msg.str() );
returnVal = false;
break;
}
tmp.push_back(at);
//std::cout << " add: " << *it << "\n";
pidstmp.push_back(*it); // pidK is not in this vector
}
}
err.checkException();
if(returnVal){
this->add(vp, tmp); // add to TupleList
// ADD THE GLOBAL PARTICLES (ids)
globalTuples.insert(make_pair(pidK, pidstmp));
}
LOG4ESPP_INFO(theLogger, "added fixed tuple to global tuples");
tmp.clear();
pids.clear();
pidstmp.clear();
//std::cout << "\n";
return returnVal;
}
示例2:
inline ISAACAPI size_t numgt1(tuple const & tp)
{ return std::accumulate(tp.begin(), tp.end(), 0, [](size_t a, size_t b){ return a + (b>1); }); }
示例3: prod
inline ISAACAPI int_t prod(tuple const & tp)
{ return std::accumulate(tp.begin(), tp.end(), 1, std::multiplies<int>()); }
示例4: min
inline ISAACAPI int_t min(tuple const & tp)
{ return std::accumulate(tp.begin(), tp.end(), std::numeric_limits<int_t>::max(), [](int_t a, int_t b){ return std::min(a, b); }); }