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

C++ prepend函数代码示例

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

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



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

示例1: prepend

Node Node::prepend(const std::string& tag, const Attributes& attributes, const std::string& text) {
	Node child = prepend(tag);
	for(auto attribute : attributes){
		child.pimpl_->append_attribute(attribute.first.c_str()) = attribute.second.c_str();
	}
	if(text.length()>0) child.pimpl_->append_child(pugi::node_pcdata).set_value(text.c_str());
	return child;
}
开发者ID:codeaudit,项目名称:stencila,代码行数:8,代码来源:xml.cpp


示例2: getAxisRotation

void Matrix3D::prependRotation(const float degrees, const Vector3D &axis, Vector3D *pivot) {
    if (pivot) {
        getAxisRotation(axis.x, axis.y, axis.y, pivot->x, pivot->y, pivot->z, degrees, _mt);
    } else {
        getAxisRotation(axis.x, axis.y, axis.y, 0, 0, 0, degrees, _mt);
    }
    prepend(_mt);
}
开发者ID:BobLChen,项目名称:opengl-es-2d-3d,代码行数:8,代码来源:Matrix3D.cpp


示例3: assert

  template <class elem_t, class holder_t> void
cdlist_tos_base<elem_t, holder_t>::insert(size_t elem_num,
    elem_t the_elem)
{
  assert(elem_num >= 0);
  size_t total;
  holder_t *follow;
  if (elem_num == 0)
  {
    prepend(the_elem);
    return;
  }
  if (elem_num >= _cached_size)
  {
    while (_cached_size < elem_num)
      append(zero((elem_t *)0));
    append(the_elem);
    return;
  }
  else if (elem_num - 1 <= _cached_index / 2)
  {
    /* Start at front. */
    total = 0;
    follow = _head_e;
  }
  else if (elem_num - 1 <= (_cached_index + _cached_size) / 2)
  {
    /* Start at cache. */
    total = _cached_index;
    follow = _cached_e;
  }
  else
  {
    /* Start at end. */
    total = _cached_size - 1;
    follow = _tail_e;
  }
  while (total < elem_num - 1)
  {
    ++total;
    follow = follow->next;
  }
  while (total > elem_num - 1)
  {
    --total;
    follow = follow->previous;
  }
  holder_t *new_e = new holder_t(the_elem, follow->next, follow);
  follow->next = new_e;
  if (_tail_e == follow)
    _tail_e = new_e;
  else
    new_e->next->previous = new_e;
  _cached_index = elem_num;
  _cached_e = new_e;
  ++_cached_size;
}
开发者ID:JehandadKhan,项目名称:roccc-2.0,代码行数:57,代码来源:cdlist_tos.cpp


示例4: source_vertices

/* Returns the list of source vertices in g */
static List source_vertices(Graph graph) {
    List sources = NULL;

    for (int i = 0; i < graph->order; i++) {
        if (!graph->vertices[i].in)
            prepend(&sources, graph->vertices + i);
    }
    return sources;
}
开发者ID:clementpoh,项目名称:toposort,代码行数:10,代码来源:toposort.c


示例5: getPath

// Returns the path from the source to given vertex
// Pre: 1 <= u <= getOrder(G)
void getPath(List L, Graph G, int u) {
   if(getSource(G) == NIL) {
      printf("Graph Error: calling getPath() with NULL source\n"); 
   }
   if(u < 1 || u > getOrder(G)) {
     printf("Graph Error: calling getPath() with vertex out of bounds\n");
     exit(1); 
   }
   int s = G->source;
   if(u == s) {
      prepend(L, s);
   } else if(G->parent[u] == NIL) {
      append(L, NIL);
   } else {
      prepend(L, u);
      getPath(L, G, G->parent[u]);
   }
}
开发者ID:bradbernard,项目名称:CMPS101,代码行数:20,代码来源:Graph.c


示例6: domain

namespace boost { namespace hana {
    struct Function {
        struct hana {
            struct operators
                : boost::hana::operators::of<Comparable>
            { };
        };
    };

    template <typename Domain, typename Codomain, typename F, typename = operators::adl>
    struct function_type {
        struct hana { using datatype = Function; };

        Domain dom;
        Codomain cod;
        F def;

        friend constexpr auto domain(function_type f)
        { return f.dom; }

        friend constexpr auto codomain(function_type f)
        { return f.cod; }

        template <typename X>
        constexpr auto operator()(X x) const {
            if (!elem(domain(*this), x))
                throw std::domain_error{"use of a hana::function with an argument out of the domain"};
            return def(x);
        }
    };

    BOOST_HANA_CONSTEXPR_LAMBDA auto function = [](auto domain, auto codomain) {
        return [=](auto definition) {
            return function_type<decltype(domain), decltype(codomain), decltype(definition)>{
                domain, codomain, definition
            };
        };
    };

    BOOST_HANA_CONSTEXPR_LAMBDA auto frange = [](auto f) {
        // Note: that would be better handled by a set data structure, but
        // whatever for now.
        return foldl(transform(domain(f), f), make<Tuple>(), [](auto xs, auto x) {
            return if_(elem(xs, x), xs, prepend(x, xs));
        });
    };


    template <>
    struct equal_impl<Function, Function> {
        template <typename F, typename G>
        static constexpr auto apply(F f, G g) {
            return domain(f) == domain(g) && all_of(domain(f), demux(equal)(f, g));
        }
    };
}} // end namespace boost::hana
开发者ID:josephwinston,项目名称:hana,代码行数:56,代码来源:function.cpp


示例7: new_edge_node

Graph *add_edge(Graph *gr, uint32_t src, uint32_t dst, double prb) {
    EdgeNode *dst_node = new_edge_node(dst);
    dst_node->prob = prb;
    Vertex *src_vertex = gr->vertices[src];
    if (src_vertex != NULL) { /* Don't access NULL pointers */
        src_vertex->edges= prepend(dst_node, src_vertex->edges);
        src_vertex->num_edges = src_vertex->num_edges + 1;
    }
    return gr;
}
开发者ID:gatlin,项目名称:markov,代码行数:10,代码来源:graph.c


示例8: add_depth

/*
 * If the previous process is your parent increase identation level.
 */
int add_depth(pid_t parent, pid_t pid, struct node **head)
{
	int rlist;

	if (parent == pid) {
		rlist = prepend(head, (pid_t) parent);
		return rlist;
	}
	return 2;
}
开发者ID:kikimo,项目名称:w4118-hmwk2,代码行数:13,代码来源:prinfo.c


示例9: ins_after

Pix BaseDLList::ins_after(Pix p, const void *datum) {
  if (p == 0) return prepend(datum);
  BaseDLNode* u = (BaseDLNode*) p;
  BaseDLNode* t = copy_node(datum);
  t->bk = u;
  t->fd = u->fd;
  u->fd->bk = t;
  u->fd = t;
  return Pix(t);
}
开发者ID:lolmid,项目名称:2015-2016,代码行数:10,代码来源:DLList.c


示例10: map_add

/* Adds a key-value pair to a map. */
void map_add(Map *map, Hashable *key, Value *value)
	{
	    int i;  //holds
	    for (i = 0; i<map->n; i++) {
	        if (map->lists[i] == NULL){
	            map->lists[i] = prepend(key, value, NULL);
	           break;
	        }
	    }
	}
开发者ID:charlenealee,项目名称:SoftwareSystems,代码行数:11,代码来源:hash.c


示例11:

			inline
			Ptr
			operator*(Ptr value)
			{
				auto m1 = Matrix4x4::create(shared_from_this());

				m1->prepend(value);

				return m1;
			}
开发者ID:Vintage12,项目名称:minko,代码行数:10,代码来源:Matrix4x4.hpp


示例12: packRaw

// take binary data and pack it to a TCP pack
QByteArray PackParser::packRaw(const QByteArray &content)
{
    auto result = content;
    quint32 length = content.length();
    uchar c1, c2, c3, c4;
    c1 = length & 0xFF;
    length >>= 8;
    c2 = length & 0xFF;
    length >>= 8;
    c3 = length & 0xFF;
    length >>= 8;
    c4 = length & 0xFF;

    result.prepend(c1);
    result.prepend(c2);
    result.prepend(c3);
    result.prepend(c4);

    return result;
}
开发者ID:aluex,项目名称:painttyWidget,代码行数:21,代码来源:packparser.cpp


示例13: reserve

Polygon::Polygon(const Circle& circle, int points) {
    if(points <= 0) points = round(circle.radius() * 15);
    if(points < 3) points = 3;
    qreal max = 2 * M_PI;
    qreal inc = max / points;
    reserve(points);
    for(qreal d = 0; d < max; d += inc) {
        prepend(Point(cos(d) * circle.radius() + circle.center().x(),
                sin(d) * circle.radius() + circle.center().y()));
    }
}
开发者ID:AntonioModer,项目名称:phed,代码行数:11,代码来源:Polygon.cpp


示例14: build_n_nodes

struct node* build_n_nodes(int num)
{
    struct node **ref_plast;
    struct node *phead = NULL;
    int i;
    ref_plast = &phead;
    for(i = 0; i < num; i++) {
        prepend(ref_plast, i);
        ref_plast = &((*ref_plast)->next);
    }
    return phead;
}
开发者ID:cshintov,项目名称:Learning-C,代码行数:12,代码来源:move_node.c


示例15: prepend

ByteArray& ByteArray::prepend(const ByteArray& other)
{
    if (isEmpty())
    {
        d = other.d;
    }
    else
    {
        prepend(other.data(), other.size());
    }
    return *this;
}
开发者ID:ropez,项目名称:pieces,代码行数:12,代码来源:byte_array.cpp


示例16: main

int main ()
{
	//these work fine - functions given by Allen
    Hashable *hashable1 = make_hashable_int (1);
    Hashable *hashable2 = make_hashable_string ("Allen");
    Hashable *hashable3 = make_hashable_int (2);

    // make_int_value also given
    Value *value1 = make_int_value (17);
	//failing here!
    Node *node1 = make_node(hashable1, value1, NULL);
	fprintf(stdout, "Print node:\n");
    print_node (node1);

    Value *value2 = make_string_value ("Downey");
    Node *list = prepend(hashable2, value2, node1);
	fprintf(stdout, "Print list:\n");
    print_list (list);

    // run some test lookups
    Value *value = list_lookup (list, hashable1);
	fprintf(stdout, "List lookup:\n");
    print_lookup(value);

	fprintf(stdout, "List lookup:\n");
    value = list_lookup (list, hashable2);
    print_lookup(value);

	fprintf(stdout, "List lookup:\n");
    value = list_lookup (list, hashable3);
    print_lookup(value);

    // make a map
    Map *map = make_map(10);
    map_add(map, hashable1, value1);
    map_add(map, hashable2, value2);

    printf ("Map\n");
    print_map(map);

    // run some test lookups
    value = map_lookup(map, hashable1);
    print_lookup(value);

    value = map_lookup(map, hashable2);
    print_lookup(value);

    value = map_lookup(map, hashable3);
    print_lookup(value);

    return 0;
}
开发者ID:ElizabethDuncan,项目名称:SoftwareSystemsClass,代码行数:52,代码来源:hash.c


示例17: _sorting

OCompletionMatches::OCompletionMatches( const OCompletionMatchesWrapper& matches )
    : _sorting( matches.sorting())
{
    if( matches.sortedList != 0L )
        OCompletionMatchesList::operator=( *matches.sortedList );
    else {
        QStringList l = matches.list();
        for( QStringList::ConstIterator it = l.begin();
                it != l.end();
                ++it )
            prepend( OSortableItem<QString, int>( 1, *it ) );
    }
}
开发者ID:opieproject,项目名称:opie,代码行数:13,代码来源:ocompletion.cpp


示例18: decimalfraction2pltext

void decimalfraction2pltext(int type,
                const std::string& n,
                std::string& tequiv,
                std::string& tinflection)
{
    size_t pos = n.find(', ');

    if (pos == std::string::npos) {
        integer2pltext(type, n, tequiv, tinflection);
        return;
    }
    std::string n0, n1, te0, te1, ti0, ti1;
    n0 = n.substr(0, pos);
    n1 = n.substr(pos+1);
    integer2pltext(type, n0, te0, ti0);
    if (equals_one_half(n1)) {
        if (type == BEFORE_NOUN) {
            if (te0 != "#")
                tequiv = te0 + "ipół";
        } else {
            join2(te0, "i pół", ti0, "0 0", tequiv, tinflection);
        }
        return;
    }
    if (type != CARDINAL && type != CARDINAL_G)
        return;
    if (n1.length() <= 3) {
        fractional2pltext(type, n1, te1, ti1);
        join3(te0, "i", te1, ti0, "0", ti1, tequiv, tinflection);
    } else {
        integer2pltext(CARDINAL, n1, te1, ti1);
        int i;
        for (i=0; n1[i]=='0'; i++) {
            prepend(te1, "zero", CARDINAL);
            prepend(ti1, "0", CARDINAL);
        }
        join3(te0, "przecinek", te1, ti0, "0", ti1, tequiv, tinflection);
    }
}
开发者ID:jgonz0010,项目名称:psi-toolkit,代码行数:39,代码来源:numconversion.cpp


示例19: IosBuildSettingsWidget

QList<ProjectExplorer::NamedWidget *> IosBuildConfiguration::createSubConfigWidgets()
{
    auto subConfigWidgets = QmakeBuildConfiguration::createSubConfigWidgets();

    Core::Id devType = ProjectExplorer::DeviceTypeKitAspect::deviceTypeId(target()->kit());
    // Ownership of this widget is with BuildSettingsWidget
    auto buildSettingsWidget = new IosBuildSettingsWidget(devType, m_signingIdentifier,
                                                          m_autoManagedSigning);
    subConfigWidgets.prepend(buildSettingsWidget);
    connect(buildSettingsWidget, &IosBuildSettingsWidget::signingSettingsChanged,
            this, &IosBuildConfiguration::onSigningSettingsChanged);
    return subConfigWidgets;
}
开发者ID:kai66673,项目名称:qt-creator,代码行数:13,代码来源:iosbuildconfiguration.cpp


示例20: sender

	void PhotosTab::PerformCtxMenu (std::function<void (QModelIndex)> functor)
	{
		const auto& idx = sender ()->property ("Blasq/Index").value<QModelIndex> ();
		if (!idx.isValid ())
			return;

		auto rows = Ui_.CollectionsTree_->selectionModel ()->selectedRows ();
		if (!rows.contains (idx))
			rows.prepend (idx);

		for (const auto& row : rows)
			functor (row);
	}
开发者ID:devel29a,项目名称:leechcraft,代码行数:13,代码来源:photostab.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ prepend_s函数代码示例发布时间:2022-05-30
下一篇:
C++ prepared函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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