本文整理汇总了C++中std::vector::rbegin方法的典型用法代码示例。如果您正苦于以下问题:C++ vector::rbegin方法的具体用法?C++ vector::rbegin怎么用?C++ vector::rbegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::vector
的用法示例。
在下文中一共展示了vector::rbegin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: push
void DataPlot::push(std::vector<SensorValues> sensors, bool left) {
if (left)
for (std::vector<SensorValues>::reverse_iterator it = sensors.rbegin();
it != sensors.rend(); it++)
push(*it, left);
else
for (std::vector<SensorValues>::iterator it = sensors.begin();
it != sensors.end(); it++)
push(*it, left);
}
示例2: SplitString
void SplitString(const std::string& str, const char delim, std::vector<std::string>& output)
{
std::istringstream iss(str);
output.resize(1);
while (std::getline(iss, *output.rbegin(), delim))
output.push_back("");
output.pop_back();
}
示例3: SaveRotationMatrix
void SpinAdapted::SaveRotationMatrix (const std::vector<int>& sites, const std::vector<Matrix>& m1, int state)
{
Timer disktimer;
int rank = mpigetrank();
if (rank == 0)
{
char file [5000];
int first = min(sites[0], *sites.rbegin()), last = max(sites[0], *sites.rbegin());
if (state == -1)
sprintf (file, "%s%s%d%s%d%s%d%s", dmrginp.save_prefix().c_str(), "/Rotation-", first, "-", last, ".", mpigetrank(),".state_average.tmp");
else
sprintf (file, "%s%s%d%s%d%s%d%s%d%s", dmrginp.save_prefix().c_str(), "/Rotation-", first, "-", last, ".", mpigetrank(),".state",state, ".tmp");
p1out << "\t\t\t Saving Rotation Matrix :: " << file << endl;
std::ofstream ofs(file, std::ios::binary);
boost::archive::binary_oarchive save_mat(ofs);
save_mat << m1;
ofs.close();
}
}
示例4: getInvocationHandlerForActualArgs
MatchedInvocationHandler* getInvocationHandlerForActualArgs(ActualInvocation<arglist...>& invocation) {
for (auto i = _invocationHandlers.rbegin(); i != _invocationHandlers.rend(); ++i) {
std::shared_ptr<Destructable> curr = *i;
Destructable& Destructable = *curr;
MatchedInvocationHandler& im = asMatchedInvocationHandler(Destructable);
if (im.getMatcher().matches(invocation)) {
return &im;
}
}
return nullptr;
}
示例5: hasByValue
/// \param[in] t_params the list of params to search
/// \param[in] t_value the value to search for
/// \returns the JobParam matching the given value. Throws an exception if it is not found
static bool hasByValue(const std::vector<JobParam> &t_params, const std::string &t_value)
{
auto itr = std::find_if(t_params.rbegin(), t_params.rend(), JobParamValueCompare(t_value));
if (itr != t_params.rend())
{
return true;
}
return false;
}
示例6: copyByte
bool Codegen::generateCallIA32(Address addr, const std::vector<Address> &args) {
for (auto iter = args.rbegin(); iter != args.rend(); ++iter) {
copyByte(0x68);
copyInt(*iter);
}
unsigned offset = addr - (buffer_.curAddr() + 5);
copyByte(0xe8);
copyInt(offset);
return true;
}
示例7: confirmReleaseActionHistoryOrder
/*
* Confirm all actions were released in the correct order
*/
void confirmReleaseActionHistoryOrder(std::vector<MockUndoActionHistory*> histories, int &expectedStartingIndex) {
for (std::vector<MockUndoActionHistory*>::reverse_iterator i = histories.rbegin();
i != histories.rend();
i++) {
const MockUndoActionHistory *history = *i;
ASSERT_TRUE(history->m_released);
ASSERT_FALSE(history->m_undone);
ASSERT_EQ(history->m_releasedIndex, expectedStartingIndex);
expectedStartingIndex++;
}
}
示例8: collectVisibleParentPerformanceSamples
void PerformanceRecordTreeWidget::collectVisibleParentPerformanceSamples() {
std::map<std::string, PerformanceSample> tempSampleMap;
std::map<std::string, PerformanceSample>::iterator tempSampleMapIterator;
std::vector<PerformanceSample*>::const_reverse_iterator sampleReverseVectorIterator;
std::string lastName;
if(performanceRecordWidget_) {
std::vector<const PerformanceRecord*> records = performanceRecordWidget_->collectPerformanceRecords();
performanceSamples_.clear();
foreach(const PerformanceRecord* record, records) {
if(QString::fromStdString(record->getName()).indexOf(QString::fromStdString(filterText_), 0, Qt::CaseInsensitive) != -1){
tempSampleMap.clear();
const std::vector<PerformanceSample*> samples = record->getSamples();
PerformanceSample parent_sample(NULL, record->getName());
if(!averageTime_){
if(samples.size()>0){
sampleReverseVectorIterator = samples.rbegin();
lastName = samples.back()->getName();
while(sampleReverseVectorIterator < samples.rend() && (samples.rbegin() == sampleReverseVectorIterator || (*sampleReverseVectorIterator)->getName() != lastName)){
parent_sample.addChild(*(*sampleReverseVectorIterator));
++sampleReverseVectorIterator;
}
}
}
else{
foreach(PerformanceSample* sample, samples){
tempSampleMapIterator = tempSampleMap.lower_bound(sample->getName());
if(tempSampleMapIterator != tempSampleMap.end() && !(tempSampleMap.key_comp()(sample->getName(), tempSampleMapIterator->first))){
tempSampleMapIterator->second = tempSampleMapIterator->second + (*sample);
}
else {
tempSampleMap.insert(std::pair<std::string, PerformanceSample>(sample->getName(), (*sample)));
}
}
for (tempSampleMapIterator=tempSampleMap.begin() ; tempSampleMapIterator != tempSampleMap.end(); tempSampleMapIterator++){
PerformanceSample* child_sample = parent_sample.addChild(tempSampleMapIterator->second);
child_sample->normalize();
}
}
performanceSamples_.push_back(parent_sample);
}
}
示例9: disconnectAll
void ConnectionManager::disconnectAll(std::vector<ConnectionNode>& connections, ossie::DomainLookup* domainLookup)
{
// Disconnect all connections made for the application in the reverse order of their creation.
LOG_TRACE(ConnectionManager, "Disconnecting " << connections.size() << " ports");
for (std::vector<ConnectionNode>::reverse_iterator connection = connections.rbegin(); connection != connections.rend(); ++connection) {
LOG_TRACE(ConnectionManager, "Disconnecting connection " << connection->identifier);
connection->disconnect(domainLookup);
}
connections.clear();
LOG_TRACE(ConnectionManager, "All connected ports disconnected");
}
示例10: tearDownCache
void tearDownCache() {
for (std::vector<Transfer::CacheLayer*>::reverse_iterator iter =
mCacheLayers.rbegin(); iter != mCacheLayers.rend(); ++iter) {
delete (*iter);
}
mCacheLayers.clear();
for (std::vector<Transfer::CachePolicy*>::iterator iter =
mCachePolicy.begin(); iter != mCachePolicy.end(); ++iter) {
delete (*iter);
}
mCachePolicy.clear();
}
示例11: find
bool find( const T &t )
{
extern bool intersects( const T &t1, const T &t2 );
std::vector<T>::reverse_iterator it = family.rbegin(), end = family.rend();
for( ; it != end ; ++it )
if( intersects(*it, t) )
return search = it, true;
return search = end, false;
}
示例12: setReprList
void Selection::setReprList(std::vector<XML::Node*> const &list) {
_clear();
for ( std::vector<XML::Node*>::const_reverse_iterator iter=list.rbegin();iter!=list.rend(); ++iter) {
SPObject *obj=_objectForXMLNode(*iter);
if (obj) {
_add(obj);
}
}
_emitChanged();
}
开发者ID:NotBrianZach,项目名称:modalComposableProgrammableFuzzySearchingVectorGraphicEditing,代码行数:12,代码来源:selection.cpp
示例13: BuildFieldOffsets
// We want a vector with the integer offset of each field relative to the righthand end of the panel
void SBPanel::BuildFieldOffsets(const std::vector<int>& fldWidths)
{
int cum = 0;
// Add up field widths starting at right end of panel
for (auto it = fldWidths.rbegin(); it != fldWidths.rend(); it++)
{
cum += *it;
fieldOffsets.push_back(cum);
}
// Reverse it because the fields are indexed from left to right
std::reverse(fieldOffsets.begin(), fieldOffsets.end());
}
示例14: DistributeRemaining
void DistributeRemaining()
{
std::sort(m_Result.begin(), m_Result.end());
for(std::vector<DistributionElem>::reverse_iterator it = m_Result.rbegin(); it != m_Result.rend(); ++it)
{
if(m_iResultingWorkers == m_iAllWorkers)
return;
++m_iResultingWorkers;
it->m_iCount++;
}
AssertBotE(false);
}
示例15: while
std::vector<int> next_palindrome( std::vector<int>& number )
{
if( number.empty() ) return {1} ;
auto mid = ( number.size() ) / 2 ;
auto begin = number.begin() ;
if( std::all_of( begin, begin+mid, [] ( int v ) { return v==9 ; } ) )
{
for( int& v : number ) v = 0 ;
number.push_back(1) ;
number.front() = 1 ;
return number ;
}
auto iter = number.rbegin() + mid ;
while( *iter == 9 ) { *iter = 0 ; ++iter ; }
++ *iter ;
std::copy( number.rbegin()+mid, number.rend(), number.begin()+mid ) ;
return number ;
}