本文整理汇总了C++中std::vector::get方法的典型用法代码示例。如果您正苦于以下问题:C++ vector::get方法的具体用法?C++ vector::get怎么用?C++ vector::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::vector
的用法示例。
在下文中一共展示了vector::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: move
unique_ptr<DocResult> Result(unique_ptr<DocResult>& base_result) {
size_t matchesNeededCount = filters_->size();
while (true) {
if (base_result == nullptr)
return nullptr;
base_result->TruncateArrayPaths(match_array_depth_);
filter_++;
if (filter_ == filters_->end())
filter_ = filters_->begin();
auto next_result = filter_->get()->FirstResult(base_result->seq);
if (next_result == nullptr)
return nullptr;
next_result->TruncateArrayPaths(match_array_depth_);
if (base_result->seq == next_result->seq) {
// got a potential match. intersect paths
if (base_result->IntersectArrayPaths(*next_result)) {
// intersection exists
if (--matchesNeededCount == 0)
// got all the matches needed, return result
return std::move(base_result);
} else {
//no way this doc is a match. get next candidate doc
base_result = filter_->get()->NextResult();
matchesNeededCount = filters_->size();
}
} else {
// no way this doc is a match. we already have next candidate
base_result = std::move(next_result);
matchesNeededCount = filters_->size();
}
}
}
示例2: get_color
static QColor get_color( const std::vector< shared_ptr<KeyFilter> > & filters, const Key & key, QColor (KeyFilter::*fun)() const ) {
const std::vector< shared_ptr<KeyFilter> >::const_iterator it
= find_if_and( filters,
bind( &KeyFilter::matches, _1, key, KeyFilter::Appearance ),
bind( &QColor::isValid, bind( fun, _1 ) ) );
if ( it == filters.end() )
return QColor();
else
return (it->get()->*fun)();
}
示例3: reset
/*! \brief Reset the iterator (it restart from the beginning)
*
*/
inline void reset()
{
act = 0;
// initialize the first iterator
reinitialize(boxes.get(0).getKP1,boxes.get(0).getKP2);
}
示例4: parse
void parse(std::vector<unique_ptr<Token>>::iterator it,
std::vector<unique_ptr<Token>>::iterator tokens_end,
ProguardConfiguration* pg_config,
unsigned int* parse_errors,
const std::string& filename) {
*parse_errors = 0;
bool ok;
while (it != tokens_end) {
// Break out if we are at the end of the token stream.
if ((*it)->type == token::eof_token) {
break;
}
uint32_t line = (*it)->line;
if (!(*it)->is_command()) {
cerr << "Expecting command but found " << (*it)->show() << " at line "
<< (*it)->line << endl;
++it;
skip_to_next_command(&it);
continue;
}
// Input/Output Options
if (parse_filepath_command(&it,
token::include,
pg_config->basedirectory,
&pg_config->includes))
continue;
if (parse_single_filepath_command(
&it, token::basedirectory, &pg_config->basedirectory))
continue;
if (parse_jars(
&it, token::injars, pg_config->basedirectory, &pg_config->injars))
continue;
if (parse_jars(
&it, token::outjars, pg_config->basedirectory, &pg_config->outjars))
continue;
if (parse_jars(&it,
token::libraryjars,
pg_config->basedirectory,
&pg_config->libraryjars))
continue;
// -skipnonpubliclibraryclasses not supported
if ((*it)->type == token::dontskipnonpubliclibraryclasses) {
// Silenty ignore the dontskipnonpubliclibraryclasses option.
++it;
continue;
}
// -dontskipnonpubliclibraryclassmembers not supported
if (parse_filepath_command(&it,
token::keepdirectories,
pg_config->basedirectory,
&pg_config->keepdirectories))
continue;
if (parse_target(&it, &pg_config->target_version)) continue;
// -forceprocessing not supported
// Keep Options
if (parse_keep(&it,
token::keep,
&pg_config->keep_rules,
true, // mark_classes
false, // mark_conditionally
false, // allowshrinking
filename,
line,
&ok)) {
if (!ok) {
(*parse_errors)++;
}
continue;
}
if (parse_keep(&it,
token::keepclassmembers,
&pg_config->keep_rules,
false, // mark_classes
false, // mark_conditionally
false, // allowshrinking
filename,
line,
&ok)) {
if (!ok) {
(*parse_errors)++;
}
continue;
}
if (parse_keep(&it,
token::keepclasseswithmembers,
&pg_config->keep_rules,
false, // mark_classes
true, // mark_conditionally
false, // allowshrinking
filename,
line,
&ok)) {
if (!ok) {
(*parse_errors)++;
}
continue;
}
if (parse_keep(&it,
//.........这里部分代码省略.........