template <typename Q, typename Func>
bool insert( const Q& key, Func f )
{
- std::pair<iterator, bool> res = m_Map.insert( value_type( key, mapped_type() ) );
+ std::pair<iterator, bool> res = m_Map.insert( value_type( key_type( key ), mapped_type() ) );
if ( res.second )
f( *res.first );
return res.second;
template <typename Q, typename... Args>
bool emplace( Q&& key, Args&&... args )
{
- std::pair<iterator, bool> res = m_Map.emplace( std::forward<Q>(key), std::move( mapped_type( std::forward<Args>(args)...)));
+ std::pair<iterator, bool> res = m_Map.emplace( key_type( std::forward<Q>( key )), mapped_type( std::forward<Args>( args )...));
return res.second;
}
std::pair<bool, bool> update( const Q& key, Func func, bool bAllowInsert )
{
if ( bAllowInsert ) {
- std::pair<iterator, bool> res = m_Map.insert( value_type( key, mapped_type() ));
+ std::pair<iterator, bool> res = m_Map.insert( value_type( key_type( key ), mapped_type() ));
func( res.second, *res.first );
return std::make_pair( true, res.second );
}
else {
- auto it = m_Map.find(key_type( key ));
+ auto it = m_Map.find( key_type( key ));
if ( it == end() )
return std::make_pair( false, false );
func( false, *it );
template <typename Q, typename Func>
bool erase( const Q& key, Func f )
{
- iterator it = m_Map.find( key_type(key) );
+ iterator it = m_Map.find( key_type( key ));
if ( it == m_Map.end() )
return false;
f( *it );
template <typename Q, typename Func>
bool find( Q& val, Func f )
{
- iterator it = m_Map.find( key_type(val) );
+ iterator it = m_Map.find( key_type( val ));
if ( it == m_Map.end() )
return false;
f( *it, val );