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


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

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


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

示例1:

// Creates a string of neighboring edge pixels.
inline
void
linking_procedure(string_t &string, unsigned char *binary_image, const size_t image_width, const size_t image_height, const int x_ref, const int y_ref, const double half_width, const double half_height)
{
	/* Leandro A. F. Fernandes, Manuel M. Oliveira
	 * Real-time line detection through an improved Hough transform voting scheme
	 * Pattern Recognition (PR), Elsevier, 41:1, 2008, 299-314.
	 *
	 * Algorithm 5
	 */

	int x, y;

	string.clear();
	
	// Find and add feature pixels to the end of the string.
	x = x_ref;
	y = y_ref;
	do
	{
		pixel_t &p = string.push_back();
		
		p.x_index = x;
		p.y_index = y;

		p.x = x - half_width;
		p.y = y - half_height;

		binary_image[y*image_width+x] = 0;
	}
	while (next( x, y, binary_image, image_width, image_height ));

	pixel_t temp;
	for (size_t i=0, j=string.size()-1; i<j; ++i, --j)
	{
		temp = string[i];
		string[i] = string[j];
		string[j] = temp;
	}

	// Find and add feature pixels to the begin of the string.
	x = x_ref;
	y = y_ref;
	if (next( x, y, binary_image, image_width, image_height ))
	{
		do
		{
			pixel_t &p = string.push_back();

			p.x_index = x;
			p.y_index = y;

			p.x = x - half_width;
			p.y = y - half_height;

			binary_image[y*image_width+x] = 0;
		}
		while (next( x, y, binary_image, image_width, image_height ));
	}
}
开发者ID:project-capo,项目名称:amber-java-drivers,代码行数:61,代码来源:linking.cpp

示例2: load_file

  bool file_manager::load_file(std::ifstream &fs, string_t& out_buf) const
  {
    if (!fs.is_open() || !fs.good()) return false;

    while (fs.good()) {
      out_buf.push_back(fs.get());
    }

    out_buf.erase(out_buf.size()-1,1);

    return true;
  }
开发者ID:amireh,项目名称:Karazeh,代码行数:12,代码来源:file_manager.cpp

示例3: _get_str_val

static void _get_str_val(const char_t *pbeg, const char_t *px, string_t &str)
{
	const char_t *pwb=pbeg;

	for(;pwb!=px;++pwb)
	{
		if(*pwb==_TX('\"')&&(pwb==pbeg||pwb[-1]!=_CH_CVT))
			continue;
		else
			str.push_back(*pwb);
	}
}
开发者ID:cugwhp,项目名称:FacGraph,代码行数:12,代码来源:argv.cpp

示例4: ParseValue

	void ParseValue(string_t &val)
	{
		if(!val.empty()&&m_idx.empty())
		{
			if(!_istspace((ushort)*val.rbegin()))
			{//append a blank in order to reserve space for '\0' of the last string.
				val.push_back(_TX(' '));
			}
			_create_arg_index(&val[0],&val[0]+val.size(),m_idx);
			
			if(m_idx.empty()) //if contains no string
				val.clear();
		}
	}
开发者ID:cugwhp,项目名称:FacGraph,代码行数:14,代码来源:argv.cpp

示例5: to_postfix

  void expression::to_postfix(string_t const& in, string_t &out)
  {

    std::vector<char> operators;
    std::vector<std::string> operands;

    string_t operand = "";
    string_t _in = utility::remove_in_string(in, ' ');
    for (char c : _in)
    {
      //~ std::cout << "checking " << c << " in " << in << "\n";
      if (!is_operator(c))
      {
        operand.push_back(c);
        continue;
      }
      if (!operand.empty()) {
        operands.push_back(operand);
        out += operand + " ";
        operand = "";
      }

      // handle operators
      if (operators.empty())
      {
        if (c == ')')
          throw hax::invalid_expression("no equivalent '(' for ')'", (inst_ ? inst_->line() : token_));

        operators.push_back(c);
        continue;
      }

      if (c == ')')
      {
        while (!operators.empty() && operators.back() != '(')
        {
          out.push_back(operators.back());
          out.push_back(' ');
          operators.pop_back();
        }

        // remove the left paranthesis
        assert(!operators.empty());
        operators.pop_back();

        continue;
      } else if (c == '(')
      {
        operators.push_back(c);
        continue;
      }

      // pop any operators in the stack with higher priority than this one, add
      // them to the postfix string, and finally push this operator onto the stack
      while (!operators.empty() && has_precedence(operators.back(), c))
      {
        out.push_back(operators.back());
        out.push_back(' ');
        operators.pop_back();
      }
      operators.push_back(c);
    }

    if (!operand.empty()) {
      out += operand + " ";
      operands.push_back(operand);
    }

    while (!operators.empty())
    {
      out.push_back(operators.back());
      out.push_back(' ');
      operators.pop_back();
    }

    //~ std::cout << "evaluating " << (absolute_ ? "constant" : "relative") << " postfix expression: " << out << "\n";
  }
开发者ID:amireh,项目名称:hasm,代码行数:77,代码来源:expression.cpp


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