• Advertisement
Sign in to follow this  

std map crash?

This topic is 3641 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im havin some issues with std::map... y application crashes when i try to close it... at _Nodeptr _Pnode = _Root(); in xtree.h when executing this.. typename AssocMap::const_iterator i = l_.find(key);
#pragma once

#include <list>
#include <algorithm>

#include <boost/function.hpp>


template<typename K, typename F>
class map_function : public boost::function<F> {
public:
  
  explicit map_function() { }

 // template<typename F2> map_function( K key, boost::function<F2> f ) { l_.push_back( l_::value_type(key, f) ); }

  
  void insert( K key, boost::function<F> f ) {  /*l_.remove( f );*/  l_.insert(AssocMap::value_type(key, f )); }
  void remove( K key ) {  /*l_.remove( f );*/  }

  template<typename T1, typename T2, typename T3, typename T4>
  void operator()(K key, T1 t1, T2 t2, T3 t3, T4 t4 ) const {
	  typename AssocMap::const_iterator i = l_.find(key);
	 /* if (i != l_.end())	  
		(i->second)(t1, t2, t3, t4 );*/	  
  }

 
private:
 typedef std::map<K,boost::function< F>> AssocMap;
  AssocMap l_;

};
/*
template<typename MF1, typename MF2>
void swap( map_function<MF1>& mf1, map_function<MF2>& mf2 )
  { mf1.swap( mf2 ); }

template<typename MF1, typename MF2>
bool operator==( const map_function<MF1>& mf1, const map_function<MF2>& mf2 ) {
  // if function doesn't provide comparisons, this is unimplementable
  // if function provides op==, this is inefficient: O(N^2) operation
  // if function provides op<, this is efficient: can keep lists sorted, or use a set
  // for now, install a placeholder:
  return false;
}

template<typename MF1, typename MF2>
bool operator!=( const map_function<MF1>& mf1, const map_function<MF2>& mf2 )
  { return !( mf1 == mf2 ); }*/



any ideas? EDIT:: removed some code

Share this post


Link to post
Share on other sites
Advertisement
std::map<UINT, boost::function</*...*/>>


i solved the problem... it seems that one of the objects that were stored were removed when its called... but i dont see how that would cause an error when getting the iterator...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement