本文整理汇总了C++中value_type::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ value_type::push_back方法的具体用法?C++ value_type::push_back怎么用?C++ value_type::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类value_type
的用法示例。
在下文中一共展示了value_type::push_back方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: regFind
/** Parses the input string to a vector of pairs
*
* Parses the input string in the form a,b,c{n},d{m},e,f
* to a vector of pairs with base number (a,b,c,d,e,f) and multipliers
* (1,1,n,m,e,f)
*
* \param[in] s as const std::string in the form a,b{n}
* \return std::vector<pair> with uint32_t (base, multiplier)
*/
void
parseString( const std::string s )
{
boost::regex regFind( "[0-9]+(\\{[0-9]+\\})*",
boost::regex_constants::perl );
boost::sregex_token_iterator iter( s.begin( ), s.end( ),
regFind, 0 );
boost::sregex_token_iterator end;
parsedInput.clear();
parsedInput.reserve( std::distance( iter, end ) );
for(; iter != end; ++iter )
{
std::string pM = *iter;
// find multiplier n and base b of b{n}
boost::regex regMultipl( "(.*\\{)|(\\})",
boost::regex_constants::perl );
std::string multipl = boost::regex_replace( pM, regMultipl, "" );
boost::regex regBase( "\\{.*\\}",
boost::regex_constants::perl );
std::string base = boost::regex_replace( pM, regBase, "" );
// no Multiplier {n} given
if( multipl == *iter )
multipl = "1";
const std::pair<uint32_t, uint32_t> g(
boost::lexical_cast<uint32_t > ( base ),
boost::lexical_cast<uint32_t > ( multipl ) );
parsedInput.push_back( g );
}
}
示例2:
hex_pair_iterator operator ++() {
// We're at the end of the input.
if (Current == End) {
IsDone = true;
return *this;
}
Pair = value_type();
for (; Current != End && Pair.size() != 2; ++Current) {
// Is a valid hex digit.
if ((*Current >= '0' && *Current <= '9') ||
(*Current >= 'a' && *Current <= 'f') ||
(*Current >= 'A' && *Current <= 'F'))
Pair.push_back(*Current);
}
// Hit the end without getting 2 hex digits. Pair is invalid.
if (Pair.size() != 2)
IsDone = true;
return *this;
}
示例3: Permutation
Permutation(IterBeg beg, IterEnd end) {
oneLineNotation.reserve(std::distance(beg, end));
for (; beg != end; ++beg)
oneLineNotation.push_back(*beg);
assert(__validity_test());
}