当前位置: 首页>>代码示例>>C++>>正文


C++ ivector::push_back方法代码示例

本文整理汇总了C++中ivector::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ ivector::push_back方法的具体用法?C++ ivector::push_back怎么用?C++ ivector::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ivector的用法示例。


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

示例1: SearchTree

void CKDTree::SearchTree(KD_Node *parent, Point &p, float radius, ivector &vec_r)
{
	if (parent==NULL || parent->IsSearched)
		return;
	parent->IsSearched=true;
	//is a child node
	if(parent->m_left==NULL && parent->m_right==NULL)
	{
		int nSize=parent->m_vecIn.size();
		for (int i=0; i<nSize; ++i)
			if(m_regionArray[parent->m_vecIn[i]].IsSeen(p, radius))
				vec_r.push_back(parent->m_vecIn[i]);
	}
	//not a child node
	else
	{
		if(parent->m_left!=NULL && !parent->m_left->IsSearched && 
			(parent->m_left->m_regOverlap.IsSeen(p, radius)))
			SearchTree(parent->m_left, p, radius, vec_r);
		if (parent->m_right!=NULL && !parent->m_right->IsSearched &&
			(parent->m_right->m_regOverlap.IsSeen(p, radius)))
			SearchTree(parent->m_right, p, radius, vec_r);
	}
	//back trace : search parent
	SearchTree(parent->m_parent, p, radius, vec_r);
}
开发者ID:WandermyzGoogleCode,项目名称:LegacyCityAdventure,代码行数:26,代码来源:KDTree.cpp

示例2: checkword

int checkword(char * str, strhash &htab, ivector &wcount, ivector &tokens, unhash &unh) {
  strtolower(str);
  int userno;
  if (htab.count(str)) {
    userno = htab[str];
    wcount[userno-1]++;
  } else {
    try {
      char * newstr = new char[strlen(str)+1];
      strcpy(newstr, str);
      wcount.push_back(1);
      unh.push_back(newstr);
      userno = unh.size();
      htab[newstr] = userno;
    } catch (bad_alloc) {
      cerr << "stringIndexer:checkstr: allocation error" << endl;
      throw;
    }
  }
  //  fprintf(stderr, "token %s (%d)\n", str, userno);
  tokens.push_back(userno);
  return userno;
}
开发者ID:BIDData,项目名称:BIDMach,代码行数:23,代码来源:utils.cpp

示例3: strcpy

int stringIndexer::
checkword(char * str) {
  int userno;
  char * newstr;
  if (htab.count(str)) {
    userno = htab[str];
    count[userno-1]++;
  } else {
    try {
      newstr = new char[strlen(str)+1];
      strcpy(newstr, str);
      userno = ++size;
      htab[newstr] = userno;
      count.push_back(1);
      unh.push_back(newstr);
    } catch (std::bad_alloc) {
      cerr << "stringIndexer:checkstr: allocation error" << endl;
      throw;
    }
  }
  return userno;
}
开发者ID:codeaudit,项目名称:BIDMach,代码行数:22,代码来源:tparse.cpp

示例4: addtok

void addtok(int tok, ivector &tokens) {
  tokens.push_back(tok | 0x80000000);
}
开发者ID:BIDData,项目名称:BIDMach,代码行数:3,代码来源:utils.cpp

示例5: parseFormat

int parseFormat(string ffname, ivector & tvec, svector & dnames, svector & delims, int *grpsize) {
  ifstream ifstr(ffname.c_str(), ios::in);
  if (ifstr.fail() || ifstr.eof()) {
    cerr << "couldnt open format file" << endl;
    throw;
  }
  char *next, *third, *newstr, *linebuf = new char[80];
  while (!ifstr.bad() && !ifstr.eof()) {
    ifstr.getline(linebuf, 80);
    if (strlen(linebuf) > 1) {
      next = strchr(linebuf, ' ');
      *next++ = 0;
      third = strchr(next, ' ');
      if (third)
	*third++ = 0;
      dnames.push_back(next);
      if (strncmp(linebuf, "int", 3) == 0) {
	tvec.push_back(ftype_int);
	delims.push_back("");
      } else if (strncmp(linebuf, "dint", 4) == 0) {
	tvec.push_back(ftype_dint);
	delims.push_back("");
      } else if (strncmp(linebuf, "qhex", 4) == 0) {
	tvec.push_back(ftype_qhex);
	delims.push_back("");
      } else if (strncmp(linebuf, "float", 5) == 0) {
	tvec.push_back(ftype_float);
	delims.push_back("");
      } else if (strncmp(linebuf, "double", 6) == 0) {
	tvec.push_back(ftype_double);
	delims.push_back("");
      } else if (strncmp(linebuf, "word", 4) == 0) {
	tvec.push_back(ftype_word);
	delims.push_back("");
      } else if (strncmp(linebuf, "string", 6) == 0) {
	tvec.push_back(ftype_string);
	ifstr.getline(linebuf, 80);
        newstr = new char[strlen(linebuf)+1];
        strcpy(newstr, linebuf);
	delims.push_back(newstr);
      } else if (strncmp(linebuf, "date", 4) == 0) {
	tvec.push_back(ftype_date);
	delims.push_back("");
      } else if (strncmp(linebuf, "mdate", 5) == 0) {
	tvec.push_back(ftype_mdate);
	delims.push_back("");
      } else if (strncmp(linebuf, "cmdate", 6) == 0) {
	tvec.push_back(ftype_cmdate);
	delims.push_back("");
      } else if (strncmp(linebuf, "dt", 2) == 0) {
	tvec.push_back(ftype_dt);
	delims.push_back("");
      } else if (strncmp(linebuf, "mdt", 3) == 0) {
	tvec.push_back(ftype_mdt);
	delims.push_back("");
      } else if (strncmp(linebuf, "group", 5) == 0) {
	sscanf(third, "%d", grpsize);
	tvec.push_back(ftype_group);
	delims.push_back("");
      } else if (strncmp(linebuf, "igroup", 6) == 0) {
	sscanf(third, "%d", grpsize);
	tvec.push_back(ftype_igroup);
	ifstr.getline(linebuf, 80);
	delims.push_back(linebuf);
      } else if (strncmp(linebuf, "digroup", 7) == 0) {
	sscanf(third, "%d", grpsize);
	tvec.push_back(ftype_digroup);
	ifstr.getline(linebuf, 80);
	delims.push_back(linebuf);
      } else {
        cerr << "couldnt parse format file line " << tvec.size()+1 << endl;
	throw;
      }
    }
  }
  return tvec.size();
  delete [] linebuf;
}
开发者ID:codeaudit,项目名称:BIDMach,代码行数:78,代码来源:tparse.cpp


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