• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ list_t类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中list_t的典型用法代码示例。如果您正苦于以下问题:C++ list_t类的具体用法?C++ list_t怎么用?C++ list_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了list_t类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: formatList

string View::formatList(list_t &list, const string d1, const string sep, const string d2) {
  string output = "";
  if(list.empty()) return output;
  FOR_l(i,list)
    output = output + (i==0 || is_dir(list[i-1]) || is_opt(list[i-1]) ? "" : sep) + list.at(i);
  return d1 + output + d2;
}
开发者ID:malloc47,项目名称:term-do,代码行数:7,代码来源:view.cpp


示例2: getRelationModel

relation_data_t Query::getRelationModel(list_t values, Model * & model)
{
    relation_data_t rData;
    QList <Model *> list;
    if(!values.empty())
    {
        QStringList fields = model->getSchema()->getFields();
        int i = 0;
        while(i < values.size())
        {
            int j = i;
            Model * temp = new Model();
            temp->setSchema(model->getSchema());
            temp->setIsNew(false);
            while(values[j] != QPair <QString, QVariant> ("", ""))
            {
                if((fields.contains(values[j].first)) && (values[j].second != ""))
                {
                    temp->setField(values[j].first, values[j].second);
                }                
                j++;
            }
            list.append(temp);
            i = j + 1;
        }
    }
    rData.insert(rName, list);
    return rData;
}
开发者ID:Aspenka,项目名称:SSD,代码行数:29,代码来源:Query.cpp


示例3: MEM_CacheLimiterHandleCClass

handle_t *MEM_CacheLimiterCClass::insert(void *data)
{
	cclass_list.push_back(new MEM_CacheLimiterHandleCClass(data, this));
	list_t::iterator it = cclass_list.end();
	--it;
	cclass_list.back()->set_iter(it);

	return cache.insert(cclass_list.back());
}
开发者ID:Aligorith,项目名称:blender,代码行数:9,代码来源:MEM_CacheLimiterC-Api.cpp


示例4: chopList

list_t View::chopList(list_t list, const string prefix) {
  if(list.empty()) return list;
  FOR_l(i,list) {
    string item = list[i];
    // normal chop
    if(!item.compare(0,prefix.length(),prefix))
      list.at(i) = item.substr(prefix.length());
    else
      list.at(i) = "["+item+"]";
  }
开发者ID:malloc47,项目名称:term-do,代码行数:10,代码来源:view.cpp


示例5: remove_even

static void remove_even(list_t &l) {
    bool even = false;
    for (auto it = l.begin(); it != l.end();) {
        if (even)
            it = l.erase(it);
        else
            ++it;

        even = !even;
    }
}
开发者ID:SubutaiBogatur,项目名称:CPP-Homework,代码行数:11,代码来源:tests.cpp


示例6:

/*@[email protected]*/ static node_t list_get_node_by_value(list_t inst, void* val) {
	node_t n = inst->head;
	int ctr = 0;
	while ((n != NULL) && (inst->cmp(node_get_value(n), val))) {
		ctr++;
		n = n->next;
	}
	return n;
}
开发者ID:dsmrd,项目名称:dsmrd,代码行数:9,代码来源:list.c


示例7: list_find

int list_find(list_t list, void *data){
    struct list_node *p = list->head;
    int i = 0;
    while (p != NULL) {
        if (list->eq(p->data, data))
            return i;
        i++;
        p = p->next;
    }
    return -1;
}
开发者ID:pocketzeroes,项目名称:proekt,代码行数:11,代码来源:design-hashmap.c


示例8: list_index_of

int list_index_of(list_t inst, void* val) {
	node_t n = inst->head;
	int rval = 0;
	while ((n != NULL) && (inst->cmp(node_get_value(n), val))) {
		rval++;
		n = n->next;
	}
	if (n == NULL) {
		rval = -1;
	}
	return rval;
}
开发者ID:dsmrd,项目名称:dsmrd,代码行数:12,代码来源:list.c


示例9: generate

string_t
generate(const string_t& method, const list_t& arguments)
{
	std::string call("H\x02\x00""C"s);

	generator::value_visitor visitor(call);
	visitor(method);
	visitor(static_cast<int_t>(arguments.size()));
	for (const auto& argument : arguments)
		boost::apply_visitor(visitor, argument);

	return std::move(call);
}
开发者ID:octopus-prime,项目名称:hessian_x3,代码行数:13,代码来源:generator.cpp


示例10: walk2

int walk2(list_t::iterator it, int s, int t)
{
    if(s==t) return 0;
    for(int i=0;i<30;i++)
    {
        if(links[s][i].size())
        {
            output.insert(it, mp(links[s][i].back(),s));
            links[s][i].pop_back();
            return walk2(it, i,t);
        }
    }
    return -1;
}
开发者ID:blmarket,项目名称:icpc,代码行数:14,代码来源:WORDCHAIN.cpp


示例11: pump

int pump(list_t::iterator it)
{
    int pos = it->second;
redo:
    for(int i=0;i<30;i++)
    {
        if(links[pos][i].size())
        {
            output.insert(it, mp(links[pos][i].back(), pos));
            links[pos][i].pop_back();
            if(walk2(it, i, pos) == -1) return -1;
            goto redo;
        }
    }
    return 0;
}
开发者ID:blmarket,项目名称:icpc,代码行数:16,代码来源:WORDCHAIN.cpp


示例12: list_clear

void list_clear(list_t inst) {
	void* val;
	node_t n = inst->head;
	node_t m;
	while (n != NULL) {
		m = n->next;
		val = node_exit(n);
		//printf("exit [email protected]%p\n", inst->val);
if (inst->lfree != NULL) {
		inst->lfree(val);
}
		n = m;
	}
	inst->head = NULL;
	inst->tail = NULL;
}
开发者ID:dsmrd,项目名称:dsmrd,代码行数:16,代码来源:list.c


示例13: solve

void solve(int dataId)
{
    int s = -1, t= -1, use = -1;
    for(int i=0;i<26;i++)
    {
        int outd = 0, ind=0;
        for(int j=0;j<26;j++)
        {
            outd += links[i][j].size();
            ind += links[j][i].size();
        }
        if(outd || ind) use = i;
        if(outd > ind+1 || ind > outd+1)
        {
            cout << "IMPOSSIBLE" << endl;
            return;
        }
        if(outd > ind)
        {
            if(s != -1)
            {
                cout << "IMPOSSIBLE" << endl;
                return;
            }
            s = i;
        }
        if(ind > outd)
        {
            if(t != -1)
            {
                cout << "IMPOSSIBLE" << endl;
                return;
            }
            t = i;
        }
    }
    if(s == -1) s = t = use;

    if(walk2(output.end(), s, t) == -1)
    {
        cout << "IMPOSSIBLE" << endl;
        return;
    }
    output.pb(mp("", t));
    foreach(it, output)
    {
        if(pump(it) == -1)
        {
            cout << "IMPOSSIBLE" << endl;
            return;
        }
    }

    for(int i=0;i<30;i++) for(int j=0;j<30;j++) if(links[i][j].size())
    {
        cout << "IMPOSSIBLE" << endl;
        return;
    }

    output.pop_back();
    list_t::iterator it = output.begin();
    do
    {
        cout << it->first;
        ++it;
        if(it == output.end()) break;
        cout << " ";
    } while(true);
    cout << endl;
}
开发者ID:blmarket,项目名称:icpc,代码行数:70,代码来源:WORDCHAIN.cpp


示例14: destruct

void MEM_CacheLimiterCClass::destruct(void *data, list_t::iterator it)
{
	data_destructor(data);
	cclass_list.erase(it);
}
开发者ID:Aligorith,项目名称:blender,代码行数:5,代码来源:MEM_CacheLimiterC-Api.cpp


示例15: if

gboolean
post_parse()
{
    if (file_ != 0)
    {
    	if (tofile_ == 0 && todir_ == 0)
	{
	    log::errorf("One of \"tofile\" or \"todir\" must be specified with \"file\"\n");
	    return FALSE;
	}
    }
    else if (filesets_.first() != 0)
    {
    	if (tofile_ != 0)
	{
	    log::errorf("Only \"todir\" is allowed with \"filesets\"\n");
	    return FALSE;
	}
    	if (todir_ == 0)
	{
	    log::errorf("Must use \"todir\" is \"filesets\"\n");
	    return FALSE;
	}
    }
    else if (file_ == 0 && filesets_.first() == 0)
    {
    	log::errorf("At least one of \"file\" or \"<fileset>\" must be present\n");
	return FALSE;
    }

    if (mapper_ == 0)
    	mapper_ = mapper_t::create("identity", 0, 0);

    return TRUE;
}
开发者ID:gnb,项目名称:cant,代码行数:35,代码来源:task_copy.C


示例16: touch

 /** Mark an element as recently used. */
 void touch (const key_type& k)
 {
     auto found (map_.find(k));
     assert(found != map_.end());
     if (found != map_.end())
         list_.splice(list_.begin(), list_, found->second);
 }
开发者ID:friederschueler,项目名称:hexahedra,代码行数:8,代码来源:lru_cache.hpp


示例17: found

    boost::optional<mapped_type&> try_get (const key_type& k)
    {
        auto found (map_.find(k));
        if (found == map_.end())
            return boost::optional<mapped_type&>();

        list_.splice(list_.begin(), list_, found->second);
        return found->second->second;
    }
开发者ID:friederschueler,项目名称:hexahedra,代码行数:9,代码来源:lru_cache.hpp


示例18: prune

 /** Prune the cache back to a given size.
  *  If the cache is larger than the maximum, the oldest entries
  *  will be deleted.
  * @post size() <= max_size
  * @param max_size  The maximum cache size */
 void prune (size_t max_size)
 {
     while (size_ > max_size)
     {
         map_.erase(list_.back().first);
         list_.pop_back();
         --size_;
     }
 }
开发者ID:friederschueler,项目名称:hexahedra,代码行数:14,代码来源:lru_cache.hpp


示例19: expand

gboolean
exec()
{
    list_iterator_t<fileset_t> iter;
    
    result_ = TRUE;
    ncopied_ = 0;
    
    exp_todir_ = expand(todir_);

    if (file_ != 0)
    {
    	string_var expfile = expand(file_);
    	copy_one(expfile, this);
    }

    /* execute for <fileset> children */
    
    for (iter = filesets_.first() ; iter != 0 ; ++iter)
	(*iter)->apply(project_->properties(), copy_one, this);
    
    exp_todir_ = (char*)0;

    return result_;
}
开发者ID:gnb,项目名称:cant,代码行数:25,代码来源:task_copy.C


示例20:

~copy_task_t()
{
    if (mapper_ != 0)
	delete mapper_;
    
    /* delete filesets */
    // TODO: void unref(refcounted_t*)
    filesets_.apply_remove(unref);
}
开发者ID:gnb,项目名称:cant,代码行数:9,代码来源:task_copy.C



注:本文中的list_t类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ list_type类代码示例发布时间:2022-05-31
下一篇:
C++ line类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap