本文整理汇总了C++中svector::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ svector::empty方法的具体用法?C++ svector::empty怎么用?C++ svector::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类svector
的用法示例。
在下文中一共展示了svector::empty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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";
}
示例2: execute
virtual void execute(cmd_context & ctx) {
if(m_arg_idx<2) {
throw cmd_exception("at least 2 arguments expected");
}
ensure_domain(ctx);
ast_manager& m = ctx.m();
func_decl_ref pred(
m.mk_func_decl(m_rel_name, m_domain->size(), m_domain->c_ptr(), m.mk_bool_sort()), m);
ctx.insert(pred);
datalog::context& dctx = m_dl_ctx->get_dl_context();
dctx.register_predicate(pred, false);
if(!m_kinds.empty()) {
dctx.set_predicate_representation(pred, m_kinds.size(), m_kinds.c_ptr());
}
m_domain = 0;
}
示例3: 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;
}
示例4: operator
// return true if n contains a variable in the range [begin, end]
bool operator()(expr * n, unsigned begin = 0, unsigned end = UINT_MAX) {
m_contains = false;
m_window = end - begin;
m_todo.reset();
m_cache.reset();
m_todo.push_back(expr_delta_pair(n, begin));
while (!m_todo.empty()) {
expr_delta_pair e = m_todo.back();
if (visit_children(e.m_node, e.m_delta)) {
m_cache.insert(e);
m_todo.pop_back();
}
if (m_contains) {
return true;
}
}
SASSERT(!m_contains);
return false;
}
示例5: execute
void execute(cmd_context & ctx) override {
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());
for (named_cmd const& nc : cmds) {
display_cmd(ctx, nc.first, nc.second);
}
}
else {
for (symbol const& s : m_cmds) {
cmd * c = ctx.find_cmd(s);
SASSERT(c);
display_cmd(ctx, s, c);
}
}
ctx.regular_stream() << "\"\n";
}
示例6: empty
bool empty() const { return m_entries.empty(); }