本文整理汇总了C++中svector::end方法的典型用法代码示例。如果您正苦于以下问题:C++ svector::end方法的具体用法?C++ svector::end怎么用?C++ svector::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类svector
的用法示例。
在下文中一共展示了svector::end方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: intersect
void intersect(const svector<F,V>& y, Op& op) const {
// can't do bounded search with std::map, otherwise we would do double binary search
// these thresholds have not been well optimized
if (m.size() < 0.1*y.size()) {
for (const_iterator xit=m.begin(); xit != m.end(); ++xit) {
const_iterator yit = y.find(xit->first);
if (yit != y.end())
op(xit->first, xit->second, yit->second);
}
} else if (0.1*m.size() > y.size()) {
for (const_iterator yit=y.begin(); yit != y.end(); ++yit) {
const_iterator xit = m.find(yit->first);
if (xit != m.end())
op(yit->first, xit->second, yit->second);
}
} else {
const_iterator xit = m.begin();
const_iterator yit = y.begin();
while (xit != m.end() && yit != y.end()) {
if (xit->first > yit->first) {
++yit;
} else if (xit->first < yit->first) {
++xit;
} else {
op(xit->first, xit->second, yit->second);
++xit; ++yit;
}
}
}
}
示例2: execute
virtual void execute(cmd_context & ctx) {
ctx.regular_stream() << "\"";
if (m_cmds.empty()) {
vector<named_cmd> cmds;
cmd_context::cmd_iterator it = ctx.begin_cmds();
cmd_context::cmd_iterator end = ctx.end_cmds();
for (; it != end; ++it) {
cmds.push_back(named_cmd((*it).m_key, (*it).m_value));
}
// named_cmd_lt is not a total order for commands, but this is irrelevant for Linux x Windows behavior
std::sort(cmds.begin(), cmds.end(), named_cmd_lt());
vector<named_cmd>::const_iterator it2 = cmds.begin();
vector<named_cmd>::const_iterator end2 = cmds.end();
for (; it2 != end2; ++it2) {
display_cmd(ctx, it2->first, it2->second);
}
}
else {
svector<symbol>::const_iterator it = m_cmds.begin();
svector<symbol>::const_iterator end = m_cmds.end();
for (; it != end; ++it) {
cmd * c = ctx.find_cmd(*it);
SASSERT(c);
display_cmd(ctx, *it, c);
}
}
ctx.regular_stream() << "\"\n";
}
示例3: display
void display(std::ostream & out, symbol const & k) const {
svector<params::entry>::const_iterator it = m_entries.begin();
svector<params::entry>::const_iterator end = m_entries.end();
for (; it != end; ++it) {
if (it->first != k)
continue;
switch (it->second.m_kind) {
case CPK_BOOL:
out << (it->second.m_bool_value?"true":"false");
return;
case CPK_UINT:
out << it->second.m_uint_value;
return;
case CPK_DOUBLE:
out << it->second.m_double_value;
return;
case CPK_NUMERAL:
out << *(it->second.m_rat_value);
return;
case CPK_SYMBOL:
out << symbol::mk_symbol_from_c_ptr(it->second.m_sym_value);
return;
case CPK_STRING:
out << it->second.m_str_value;
return;
default:
out << "internal";
return;
}
}
out << "default";
}
示例4: switch
void display_smt2(std::ostream & out, char const* module, param_descrs& descrs) const {
svector<params::entry>::const_iterator it = m_entries.begin();
svector<params::entry>::const_iterator end = m_entries.end();
for (; it != end; ++it) {
if (!descrs.contains(it->first)) continue;
out << "(set-option :";
out << module << ".";
out << it->first;
switch (it->second.m_kind) {
case CPK_BOOL:
out << " " << (it->second.m_bool_value?"true":"false");
break;
case CPK_UINT:
out << " " <<it->second.m_uint_value;
break;
case CPK_DOUBLE:
out << " " << it->second.m_double_value;
break;
case CPK_NUMERAL:
out << " " << *(it->second.m_rat_value);
break;
case CPK_SYMBOL:
out << " " << symbol::mk_symbol_from_c_ptr(it->second.m_sym_value);
break;
case CPK_STRING:
out << " " << it->second.m_str_value;
break;
default:
UNREACHABLE();
break;
}
out << ")\n";
}
}
示例5: validate
void validate(param_descrs const & p) const {
svector<params::entry>::const_iterator it = m_entries.begin();
svector<params::entry>::const_iterator end = m_entries.end();
for (; it != end; ++it) {
param_kind expected = p.get_kind(it->first);
if (expected == CPK_INVALID)
throw default_exception("unknown parameter '%s'", it->first.str().c_str());
if (it->second.m_kind != expected)
throw default_exception("parameter kind mismatch '%s'", it->first.str().c_str());
}
}
示例6: implode
// concat array of string into one string
std::string implode(const char delimiter, const svector<std::string>& elements)
{
if (elements.empty())
{
return "";
}
std::string res;
svector<string>::const_iterator it = elements.begin();
res = *it;
it++;
for(; it != elements.end(); it++)
{
res += delimiter;
res += *it;
}
return res;
}
示例7: validate
void validate(param_descrs const & p) {
svector<params::entry>::iterator it = m_entries.begin();
svector<params::entry>::iterator end = m_entries.end();
symbol suffix, prefix;
for (; it != end; ++it) {
param_kind expected = p.get_kind_in_module(it->first);
if (expected == CPK_INVALID) {
std::stringstream strm;
strm << "unknown parameter '" << it->first.str() << "'\n";
strm << "Legal parameters are:\n";
p.display(strm, 2, false, false);
throw default_exception(strm.str());
}
if (it->second.m_kind != expected &&
!(it->second.m_kind == CPK_UINT && expected == CPK_NUMERAL)) {
std::stringstream strm;
strm << "Parameter " << it->first.str() << " was given argument of type ";
strm << it->second.m_kind << ", expected " << expected;
throw default_exception(strm.str());
}
}
}