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

C++ set1函数代码示例

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

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



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

示例1: addRecursive

bool addRecursive(CuckooMap* map, uint64_t key, uint64_t value, int depth)
{
	if(depth > MAX_LOOP)
	{
		return false;
	}
	//if its empty in the first table, add it there
	if(getKey1(map, key) == NONE)
	{
		set1(map, key, value);
	}
	//if its empty in the second table, add it there
	else if(getKey2(map, key) == NONE)
	{
		set2(map, key, value);
	}
	//if both are occupied, randomly displace one and re-add the displaced one
	else if((xorshf96() & 1) == 0)
	{
		uint64_t pushedKey = getKey1(map, key);
		uint64_t pushedValue = getValue1(map, key);
		set1(map, key, value);
		return addRecursive(map, pushedKey, pushedValue, depth + 1);
	}
	else
	{
		uint64_t pushedKey = getKey2(map, key);
		uint64_t pushedValue = getValue2(map, key);
		set2(map, key, value);
		return addRecursive(map, pushedKey, pushedValue, depth + 1);
	}
	return true;
}
开发者ID:seokhohong,项目名称:Reverse-Game-Of-Life,代码行数:33,代码来源:CuckooMap.c


示例2: handle

 void handle(event me[2])
 { if(is1(flag,0)&&is1(me[1].b,0))
   { if(me[1].x>=x&&me[1].x<(x+w)&&me[1].y>=y&&me[1].y<(y+h))
      set1(flag,1);
     else
      set0(flag,1);
   }
   if(is1(flag,1))
   {if(me[1].key==1)
    {
     if(me[1].ch==8){if(no>0){no--;st[no]=0;}}
     else if(me[1].ch==13){set1(flag,2);}
     else if(no<num&&isalnum(me[1].ch))
     {st[no]=me[1].ch;
      no++;
      st[no]=0;
     }
    }
    if(me[1].key==2)
    {if(me[1].ch==72)set1(flag,3);
     else if(me[1].ch==80)set1(flag,4);
    }
    setfillstyle(SOLID_FILL,ACOL);
    bar(x,y-2,x+w+1,y+h+2);
   }
   setfillstyle(SOLID_FILL,8);
   bar(x+w1,y,x+w,y+h);
   setcolor(color);
   outtextxy(x+1,y+3,str);
   setcolor(15);
   outtextxy(x+1+w1,y+3,st);
 }
开发者ID:kirankakkeratd,项目名称:Turbo-C-Projects,代码行数:32,代码来源:GRAVITY.CPP


示例3: dvmDdmGenerateThreadStats

/*
 * Generate the contents of a THST chunk.  The data encompasses all known
 * threads.
 *
 * Response has:
 *  (1b) header len
 *  (1b) bytes per entry
 *  (2b) thread count
 * Then, for each thread:
 *  (4b) threadId
 *  (1b) thread status
 *  (4b) tid
 *  (4b) utime 
 *  (4b) stime 
 *  (1b) is daemon?
 *
 * The length fields exist in anticipation of adding additional fields
 * without wanting to break ddms or bump the full protocol version.  I don't
 * think it warrants full versioning.  They might be extraneous and could
 * be removed from a future version.
 *
 * Returns a new byte[] with the data inside, or NULL on failure.  The
 * caller must call dvmReleaseTrackedAlloc() on the array.
 */
ArrayObject* dvmDdmGenerateThreadStats(void)
{
    const int kHeaderLen = 4;
    const int kBytesPerEntry = 18;

    dvmLockThreadList(NULL);

    Thread* thread;
    int threadCount = 0;
    for (thread = gDvm.threadList; thread != NULL; thread = thread->next)
        threadCount++;

    /*
     * Create a temporary buffer.  We can't perform heap allocation with
     * the thread list lock held (could cause a GC).  The output is small
     * enough to sit on the stack.
     */
    int bufLen = kHeaderLen + threadCount * kBytesPerEntry;
    u1 tmpBuf[bufLen];
    u1* buf = tmpBuf;

    set1(buf+0, kHeaderLen);
    set1(buf+1, kBytesPerEntry);
    set2BE(buf+2, (u2) threadCount);
    buf += kHeaderLen;

    pid_t pid = getpid();
    for (thread = gDvm.threadList; thread != NULL; thread = thread->next) {
        unsigned long utime, stime;
        bool isDaemon;

        if (!getThreadStats(pid, thread->systemTid, &utime, &stime)) {
            // failed; drop in empty values
            utime = stime = 0;
        }

        isDaemon = dvmGetFieldBoolean(thread->threadObj,
                        gDvm.offJavaLangThread_daemon);

        set4BE(buf+0, thread->threadId);
        set1(buf+4, thread->status);
        set4BE(buf+5, thread->systemTid);
        set4BE(buf+9, utime);
        set4BE(buf+13, stime);
        set1(buf+17, isDaemon);

        buf += kBytesPerEntry;
    }
    dvmUnlockThreadList();


    /*
     * Create a byte array to hold the data.
     */
    ArrayObject* arrayObj = dvmAllocPrimitiveArray('B', bufLen, ALLOC_DEFAULT);
    if (arrayObj != NULL)
        memcpy(arrayObj->contents, tmpBuf, bufLen);
    return arrayObj;
}
开发者ID:Andproject,项目名称:platform_dalvik,代码行数:83,代码来源:Ddm.c


示例4: eventFinish

/*
 * Write the header into the buffer and send the packet off to the debugger.
 *
 * Takes ownership of "pReq" (currently discards it).
 */
static void eventFinish(JdwpState* state, ExpandBuf* pReq)
{
    u1* buf = expandBufGetBuffer(pReq);

    set4BE(buf, expandBufGetLength(pReq));
    set4BE(buf+4, dvmJdwpNextRequestSerial(state));
    set1(buf+8, 0);     /* flags */
    set1(buf+9, kJdwpEventCommandSet);
    set1(buf+10, kJdwpCompositeCommand);

    dvmJdwpSendRequest(state, pReq);

    expandBufFree(pReq);
}
开发者ID:handgod,项目名称:soma,代码行数:19,代码来源:JdwpEvent.cpp


示例5: docomplete

/*ARGSUSED*/
void
docomplete(Char **v, struct command *t)
{
    struct varent *vp;
    Char *p;
    Char **pp;

    USE(t);
    v++;
    p = *v++;
    if (p == 0)
	tw_prlist(&completions);
    else if (*v == 0) {
	vp = adrof1(strip(p), &completions);
	if (vp && vp->vec)
	    tw_pr(vp->vec), xputchar('\n');
	else
	{
#ifdef TDEBUG
	    xprintf("tw_find(%s) \n", short2str(strip(p)));
#endif /* TDEBUG */
	    pp = tw_find(strip(p), &completions, FALSE);
	    if (pp)
		tw_pr(pp), xputchar('\n');
	}
    }
    else
	set1(strip(p), saveblk(v), &completions, VAR_READWRITE);
} /* end docomplete */
开发者ID:2trill2spill,项目名称:freebsd,代码行数:30,代码来源:tw.comp.c


示例6: main

int
main (int argc, char** argv)
{
  static bitfield a;
  bitfield b = bfi1 (a);
  bitfield c = bfi2 (b);
  bitfield d = movk (c);

  if (d.eight != 3)
    abort ();

  if (d.five != 7)
    abort ();

  if (d.sixteen != 7531)
    abort ();

  d = set1 (d);
  if (d.five != 0x1f)
    abort ();

  d = set0 (d);
  if (d.five != 0)
    abort ();

  return 0;
}
开发者ID:0day-ci,项目名称:gcc,代码行数:27,代码来源:insv_1.c


示例7: main

int main()
{
  while(1){
    set1();
  }
  return 0;
}
开发者ID:sij1mii,项目名称:Code,代码行数:7,代码来源:Anime.c


示例8: button

 button(int x1,int y1)
 {x=x1;y=y1;flag=0;
  h=charheight+4;w=639-x1-2;
  w1=textwidth(" PLAY : ");
  w2=textwidth(" PAUSE : ");
  set1(flag,1);
 }
开发者ID:kirankakkeratd,项目名称:Turbo-C-Projects,代码行数:7,代码来源:GRAVITY.CPP


示例9: QToolBar

Tools_toolbar::Tools_toolbar(CGAL::Qt_widget *w, QMainWindow *mw) :
  QToolBar(mw, "NT")
{
    //when it is created, the toolbar has 0 buttons
    nr_of_buttons = 0;
    //set the widget
    widget = w;
    widget->attach(&getpolybut);
    getpolybut.deactivate();

    QIconSet set0(QPixmap( (const char**)arrow_small_xpm ),
                  QPixmap( (const char**)arrow_xpm ));
    QIconSet set1(QPixmap( (const char**)polygon_small_xpm ),
                  QPixmap( (const char**)polygon_xpm ));

  but[0] = new QToolButton(this, "deactivate layer");
  but[0]->setIconSet(set0);
  but[0]->setTextLabel("Deactivate Layer");

  but[1] = new QToolButton(this, "polygon");
  but[1]->setIconSet(set1);
  but[1]->setTextLabel("Input Polygon");

  button_group = new QButtonGroup(0, "exclusive_group");
  button_group->insert(but[0]);
  button_group->insert(but[1]);
  button_group->setExclusive(true);

  but[0]->setToggleButton(true);
  but[1]->setToggleButton(true);

  connect(but[1], SIGNAL(stateChanged(int)),
        &getpolybut, SLOT(stateChanged(int)));
  nr_of_buttons = 2;
  }
开发者ID:BijanZarif,项目名称:mshr,代码行数:35,代码来源:straight_skeleton_2_toolbar.cpp


示例10: TEST

TEST(TSet, compare_two_sets_of_non_equal_sizes)
{
  const int size1 = 4, size2 = 6;
  TSet set1(size1), set2(size2);

  EXPECT_EQ(1, set1 != set2);
}
开发者ID:NorthlaneKek,项目名称:mp2-lab1-set,代码行数:7,代码来源:test_tset.cpp


示例11: main

int main(int argc, char *argv[])
{
  /* sets to be used for testing */
  char s[5] = {'1','2','3','4','\0'};
  char t[4] = {'1','2','3','\0'};
  char u[1] = {'\0'};
  char v[4] = {'x','y','z','\0'};
  
  /* sets to contain results */
  char a[SIZE];
  char b[SIZE];
  char c[SIZE];
  char d[SIZE];
  
  /* SetTypes for testing */
  SetType set1(s);
  SetType set2(t);
  SetType set3(u);
  
  /* test of is_empty. Should output "Set is empty" followed by "Set is not
      empty */
  set3.is_empty() ? cout << "Set is empty\n" : cout << "Set is not empty\n";
  set1.is_empty() ? cout << "Set is empty\n" : cout << "Set is not empty\n";
  
  /* test of is_equal. Should output "s is equal" followed by "t is not equal" 
  */
  set1.is_equal(s) ? cout << "s is equal\n" : cout << "s is not equal\n";
  set1.is_equal(t) ? cout << "t is equal\n" : cout << "t is not equal\n";
  
  /* test of is_member. Should output "4 is a member" followed by "8 is not a
      member */
  set1.is_member('4') ? cout << "4 is a member\n" : cout << "4 is not a member\n";
  set1.is_member('8') ? cout << "8 is a member\n" : cout << "8 is not a member\n";
  
  /* test of is_subset. Should output "t is a subset" followed by "v is not a
      subset */
  set1.is_subset(t) ? cout << "t is a subset\n" : cout << "t is not a subset\n";
  set1.is_subset(v) ? cout << "v is a subset\n" : cout << "v is not a subset\n";
  
  /* test of setunion. Should output all elements from s and v. Implicitly
      tests the write function. */
  set1.setunion(v, a);
  SetType set4(a);
  set4.write();
  
  /* test of intersection. Should output all elements in both t and s. */
  set1.intersection(t, b);
  SetType set5(b);
  set5.write();
  
  /* test of difference. Should output all elements only in t or only in s */
  set1.difference(t, d);
  SetType set7(d);
  set7.write();

  /* return success */
  return 0;
}
开发者ID:BSierakowski,项目名称:personal_code,代码行数:58,代码来源:main.cpp


示例12: set1

void parser_imp::code_with_callbacks(std::function<void()> && f) {
    m_script_state->apply([&](lua_State * L) {
            set_io_state    set1(L, m_io_state);
            set_environment set2(L, m_env);
            m_script_state->exec_unprotected([&]() {
                    f();
                });
        });
}
开发者ID:Paradoxika,项目名称:lean,代码行数:9,代码来源:parser_imp.cpp


示例13: set

/*
 * The caller is responsible for putting value in a safe place
 */
void
set(Char *var, Char *val)
{
    Char **vec = xreallocarray(NULL, 2, sizeof(Char **));

    vec[0] = val;
    vec[1] = 0;
    set1(var, vec, &shvhed);
}
开发者ID:Open343,项目名称:bitrig,代码行数:12,代码来源:set.c


示例14: GUI

 GUI():t1("    Application on ",450,10,0),
       t2("Gravitation b/w 2 mass",450,12+charheight+8,0),
       e1("Mass 1 : ",450,12+3*(charheight+8),15,COL1),
       e2("Mass 2 : ",450,12+4*(charheight+8),15,COL2),
       e3("    X1 : ",450,12+5*(charheight+8),15,COL1),
       e4("    Y1 : ",450,12+6*(charheight+8),15,COL1),
       e5("    X2 : ",450,12+7*(charheight+8),15,COL2),
       e6("    Y2 : ",450,12+8*(charheight+8),15,COL2),
       b(450,15+17*(charheight+8)),
       rb1("Motion in Monitor's ","reference frame",450,12+10*(charheight+8)),
       rb2("Motion in reference","frame of C.M.",450,12+12*(charheight+8)),
       scrbar(450,12+15.5*(charheight+8)),
       t3("Press ESC to exit",450,12+19*(charheight+8),0)
 {set1(e1.flag,0);
  set1(e2.flag,0);
  set1(e1.flag,1);
  set1(rb1.flag,1);
  set1(scrbar.flag,0);
 }
开发者ID:kirankakkeratd,项目名称:Turbo-C-Projects,代码行数:19,代码来源:GRAVITY.CPP


示例15: SqlStatement

SqlInsert::operator SqlStatement() const {
    String s = "insert into " + table.Quoted();
    if(!set1.IsEmpty()) {
        s << set1();
        if(sel.IsValid())
            s << ' ' << SqlStatement(sel).GetText();
        else if(!set2.IsEmpty())
            s << " values " << set2();
    }
    return SqlStatement(s);
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:11,代码来源:SqlStatement.cpp


示例16: TEST

TEST(TSet, can_use_sum_for_three_sets)
{
	const int size = 10;
	TSet set0(size), set1(size), set2(size), set3(size), expSet(size);
	set0.InsElem(1);
	set1.InsElem(3);
	set2.InsElem(5);
	set3 = set0 + set1 + set2;
	expSet.InsElem(1);
	expSet.InsElem(3);
	expSet.InsElem(5);
	EXPECT_EQ(expSet, set3);
}
开发者ID:Lyzzerg,项目名称:mp2-lab1-set,代码行数:13,代码来源:test_tset.cpp


示例17: dvmJdwpDdmSendChunkV

/*
 * Send up a chunk of DDM data.
 *
 * While this takes the form of a JDWP "event", it doesn't interact with
 * other debugger traffic, and can't suspend the VM, so we skip all of
 * the fun event token gymnastics.
 */
void dvmJdwpDdmSendChunkV(JdwpState* state, int type, const struct iovec* iov,
    int iovcnt)
{
    u1 header[kJDWPHeaderLen + 8];
    size_t dataLen = 0;

    assert(iov != NULL);
    assert(iovcnt > 0 && iovcnt < 10);

    /*
     * "Wrap" the contents of the iovec with a JDWP/DDMS header.  We do
     * this by creating a new copy of the vector with space for the header.
     */
    struct iovec wrapiov[iovcnt+1];
    for (int i = 0; i < iovcnt; i++) {
        wrapiov[i+1].iov_base = iov[i].iov_base;
        wrapiov[i+1].iov_len = iov[i].iov_len;
        dataLen += iov[i].iov_len;
    }

    /* form the header (JDWP plus DDMS) */
    set4BE(header, sizeof(header) + dataLen);
    set4BE(header+4, dvmJdwpNextRequestSerial(state));
    set1(header+8, 0);     /* flags */
    set1(header+9, kJDWPDdmCmdSet);
    set1(header+10, kJDWPDdmCmd);
    set4BE(header+11, type);
    set4BE(header+15, dataLen);

    wrapiov[0].iov_base = header;
    wrapiov[0].iov_len = sizeof(header);

    /*
     * Make sure we're in VMWAIT in case the write blocks.
     */
    int oldStatus = dvmDbgThreadWaiting();
    dvmJdwpSendBufferedRequest(state, wrapiov, iovcnt+1);
    dvmDbgThreadContinuing(oldStatus);
}
开发者ID:handgod,项目名称:soma,代码行数:46,代码来源:JdwpEvent.cpp


示例18: QToolBar

Tools_toolbar::Tools_toolbar(CGAL::Qt_widget *w,
			     QMainWindow *mw) : QToolBar(mw, "NT")
  {
    w->attach(&input_point);
    input_point.deactivate();
    w->attach(&input_line);
    input_line.deactivate();
    w->attach(&input_polygon);
    input_polygon.deactivate();

    //set the widget
    widget = w;

    QIconSet set0(QPixmap( (const char**)arrow_small_xpm ),
                  QPixmap( (const char**)arrow_xpm ));
    QIconSet set1(QPixmap( (const char**)point_small_xpm ),
                  QPixmap( (const char**)point_xpm ));
    QIconSet set2(QPixmap( (const char**)line_small_xpm ),
                  QPixmap( (const char**)line_xpm ));
    QIconSet set3(QPixmap( (const char**)polygon_small_xpm ),
                  QPixmap( (const char**)polygon_xpm ));

  but[0] = new QToolButton(this, "Deactivate Layer");
  but[0]->setIconSet(set0);
  but[0]->setTextLabel("Deactivate Layer");
  but[1] = new QToolButton(this, "pointinput layer");
  but[1]->setIconSet(set1);
  but[1]->setTextLabel("Input Point");
  but[2] = new QToolButton(this, "lineinput layer");
  but[2]->setIconSet(set2);
  but[2]->setTextLabel("Input Line");
  but[3] = new QToolButton(this, "polygoninput layer");
  but[3]->setIconSet(set3);
  but[3]->setTextLabel("Input Simple Polygon");

  nr_of_buttons = 4;
  button_group = new QButtonGroup(0, "My_group");
  for(int i = 0; i<nr_of_buttons; i++) {
    button_group->insert(but[i]);
    but[i]->setToggleButton(true);
  }
  button_group->setExclusive(true);

  connect(but[1], SIGNAL(stateChanged(int)),
        &input_point, SLOT(stateChanged(int)));
  connect(but[2], SIGNAL(stateChanged(int)),
        &input_line, SLOT(stateChanged(int)));
  connect(but[3], SIGNAL(stateChanged(int)),
        &input_polygon, SLOT(stateChanged(int)));
}
开发者ID:BijanZarif,项目名称:mshr,代码行数:50,代码来源:Qt_widget_toolbar.cpp


示例19: TEST

TEST(IntervalTest, InfixOperator)
{
  IntervalSet<int> set1(Bound<int>::closed(0), Bound<int>::closed(1));
  IntervalSet<int> set2(Bound<int>::closed(2), Bound<int>::open(3));
  IntervalSet<int> set3(Bound<int>::closed(0), Bound<int>::closed(2));

  EXPECT_EQ(set3, set1 + set2);
  EXPECT_EQ(set3, set1 + (Bound<int>::closed(2), Bound<int>::open(3)));
  EXPECT_EQ(set3, set1 + 2);

  EXPECT_EQ(set1, set3 - set2);
  EXPECT_EQ(set2, set3 - (Bound<int>::closed(0), Bound<int>::closed(1)));
  EXPECT_EQ(set1, set3 - 2);
}
开发者ID:447327642,项目名称:mesos,代码行数:14,代码来源:interval_tests.cpp


示例20: set_bufsize

static void *limiter_new(t_symbol *s, int argc, t_atom *argv)
{
  t_limiter *x = (t_limiter *)pd_new(limiter_class);
  int i = 0;

  if (argc) set_bufsize(x, atom_getfloat(argv));
  else
    {
      argc = 1;
      set_bufsize(x, 0);
    }

  if (argc > 64)	argc=64;
  if (argc == 0)	argc=1;

  x->number_of_inlets = argc--;

  while (argc--)
    {
      inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
    }

  outlet_new(&x->x_obj, &s_signal);

  x->in = (t_inbuf*)getbytes(sizeof(t_inbuf) * x->number_of_inlets);
  while (i < x->number_of_inlets)
    {
      int n;
      t_sample* buf = (t_sample *)getbytes(sizeof(*buf) * x->buf_size);
      x->in[i].ringbuf		= buf;
      x->in[i].buf_position	= 0;
      for (n = 0; n < x->buf_size; n++) x->in[i].ringbuf[n] = 0.;
      i++;
    }

  x->val1 = (t_limctl *)getbytes(sizeof(t_limctl));
  x->val2 = (t_limctl *)getbytes(sizeof(t_limctl));
  x->cmp = (t_cmpctl *)getbytes(sizeof(t_cmpctl));

  x->cmp->ratio = 1.;
  x->cmp->treshold = 1;

  set1(x, 100, 30, 139);
  set2(x, 110, 5, 14.2);

  x->amplification= 1;
  x->samples_left	= x->still_left = x->mode = 0;

  return (x);
}
开发者ID:Tzero2,项目名称:pd,代码行数:50,代码来源:limiter~.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ set2函数代码示例发布时间:2022-05-30
下一篇:
C++ set函数代码示例发布时间: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