本文整理匯總了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 ));
}
}
示例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;
}
示例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);
}
}
示例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();
}
}
示例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";
}