}
template <typename Q, typename Func>
- std::pair<bool, bool> ensure( const Q& val, Func func )
+ std::pair<bool, bool> update( const Q& val, Func func, bool bAllowInsert )
{
iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() );
if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) {
// insert new
+ if ( !bAllowInsert )
+ return std::make_pair( false, false );
+
value_type newItem( val );
it = m_Vector.insert( it, newItem );
func( true, *it, val );