本文整理汇总了C++中SequenceT类的典型用法代码示例。如果您正苦于以下问题:C++ SequenceT类的具体用法?C++ SequenceT怎么用?C++ SequenceT使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SequenceT类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trim_left_if
inline void trim_left_if(SequenceT& Input)
{
Input.erase(
Input.begin(),
trim_begin(
Input.begin(),
Input.end() )
);
}
示例2: trim_right_if
inline void trim_right_if(SequenceT& Input)
{
Input.erase(
trim_end(
Input.begin(),
Input.end() ),
Input.end()
);
}
示例3: Intersperse
SequenceT Intersperse(const typename SequenceT::value_type & elem, const SequenceT & sequence)
{
if( sequence.size() <= 1 ) return sequence;
SequenceT newSequence;
for( const typename SequenceT::value_type & t : sequence ) {
newSequence.push_back(t);
newSequence.push_back(elem);
}
// Remove the last occurence of elem from the end of the new sequence.
newSequence.pop_back();
return newSequence;
}
示例4: trim_left_if
inline void trim_left_if(SequenceT& Input, PredicateT IsSpace)
{
Input.erase(
::boost::begin(Input),
::boost::algorithm::detail::trim_begin(
::boost::begin(Input),
::boost::end(Input),
IsSpace));
}
示例5: trim_right_if
inline void trim_right_if(SequenceT& Input, PredicateT IsSpace)
{
Input.erase(
::mars_boost::algorithm::detail::trim_end(
::mars_boost::begin(Input),
::mars_boost::end(Input),
IsSpace ),
::mars_boost::end(Input)
);
}
示例6: SaveData
void SaveData(SequenceT& buf) const
{
switch (_type)
{
case OBJTYPE_INTEGER:
buf.append((typename SequenceT::value_type const*)&_i, sizeof(uint32_t));
break;
case OBJTYPE_REAL:
case OBJTYPE_UNREAL:
buf.append((typename SequenceT::value_type const*)&_f, sizeof(float));
break;
case OBJTYPE_STRING:
buf.append(_s);
buf.push_back('\0');
break;
default:
throw base::exception("Unexpected data type: %d.", _type);
break;
}
}
示例7: longestCommonPrefix
std::string longestCommonPrefix(const SequenceT& strings)
{
if (strings.empty())
return "";
typename SequenceT::const_iterator itr = strings.begin();
std::string result = *itr;
for (++itr; itr != strings.end(); ++itr)
{
const std::string& target = *itr;
if (result.empty())
return "";
for (size_t j=0; j < target.length() && j < result.length(); ++j)
if (target[j] != result[j])
{
result.resize(j);
break;
}
}
return result;
}
示例8: print_sequence
void print_sequence(string name, const SequenceT<T> & printMe) {
print_info(name,printMe);
typename SequenceT<T>::const_iterator i;
for (i = printMe.begin(); i != printMe.end(); ++i)
cout << '\t' << "SequenceT[" << "] is (" << *i << ")" << endl;
}
示例9: print_info
void print_info(string name, const SequenceT<T> & printMe) {
cout << "PRINTING " << name << ":" << "which has size(" << printMe.size() << ")"
<< " and cap(" << printMe.capacity() << ")" << endl;
}