本文整理汇总了C++中container_type::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ container_type::erase方法的具体用法?C++ container_type::erase怎么用?C++ container_type::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类container_type
的用法示例。
在下文中一共展示了container_type::erase方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: construct
/**
* @brief Construct data of the Entity from an XML object
*
* <p> Constructs the EntityGroup's own member variables only from the input XML object. </p>
*
* <p> Do not consider about constructing children Entity objects' data in EntityGroup::construct().
* Those children Entity objects' data will constructed by their own construct() method. Even insertion
* of XML objects representing children are done by abstract method of EntityGroup::toXML(). </p>
*
* <p> Constructs only data of EntityGroup's own. </p>
*
* \par [Inherited]
* @copydoc Entity::construct()
*/
virtual void construct(std::shared_ptr<library::XML> xml)
{
clear();
if (xml->has(CHILD_TAG()) == false)
return;
std::shared_ptr<library::XMLList> &xmlList = xml->get(CHILD_TAG());
if (std::is_same<container_type, std::vector<container_type::value_type, container_type::allocator_type>>::value == true)
{
//FOR RESERVE
assign(xmlList->size(), nullptr);
erase(begin(), end());
}
for (size_t i = 0; i < xmlList->size(); i++)
{
std::shared_ptr<library::XML> &xmlElement = xmlList->at(i);
entity_type *entity = createChild(xmlElement);
if (entity != nullptr)
{
entity->construct(xmlList->at(i));
emplace_back(entity);
}
}
};
示例2: erase
void erase(const typename container_type::value_type::key_type &key)
{
for (auto it = begin(); it != end(); )
if (it->key() == key)
it = erase(it);
else
it++;
};
示例3: merge_and_replace
range_size_type merge_and_replace(container_type& set,
iterator_pair sequence, const range_type& new_range)
{
ASSERT( sequence.first != sequence.second );
if ( sequence.first->begin() <= new_range.begin()
&& sequence.first->end() >= new_range.end() ) return 0;
range_size_type old_sum = m_length_sum;
range_size_type low = min( sequence.first->begin(), new_range.begin() );
range_size_type high = max( ( --sequence.second )->end(), new_range.end() );
for ( ++sequence.second; sequence.first != sequence.second; )
{
range_size_type length = sequence.first->size();
set.erase( sequence.first++ );
m_length_sum -= length;
}
set.insert( sequence.second, range_type( low, high ) );
m_length_sum += high - low;
return m_length_sum - old_sum;
}
示例4: erase
iterator erase(iterator it) {
return values.erase(it);
}