M
mscava
I'm building DataManager<T>. A class where shared data will be stored.
One of things useful to implement is garbage collection. But it still
gives me this error:
stl_algo.h:1076: error: non-static const member `const std::string
DataMapPair::first', can't use default assignment operator
Here's my code:
typedef std::map< std::string, std:air< bool, CountedPtr<T> > >
DataMap;
typedef std:air< std::string, std:air< bool, CountedPtr<T> > >
DataMapPair;
DataMap dataMap_;
template <typename T> bool DataManager<T> ::
IsGarbage( const DataMapPair& dmPair )
{
return ( dmPair.second.first && dmPair.second.second.IsUnique() );
}
template <typename T> void DataManager<T> ::
CollectGarbage()
{
dataMap_.erase( remove_if( dataMap_.begin(), dataMap_.end(),
IsGarbage ), dataMap_.end() );
}
Can anyone tell how should I oveload that operator=? Or should I do
something else?
One of things useful to implement is garbage collection. But it still
gives me this error:
stl_algo.h:1076: error: non-static const member `const std::string
DataMapPair::first', can't use default assignment operator
Here's my code:
typedef std::map< std::string, std:air< bool, CountedPtr<T> > >
DataMap;
typedef std:air< std::string, std:air< bool, CountedPtr<T> > >
DataMapPair;
DataMap dataMap_;
template <typename T> bool DataManager<T> ::
IsGarbage( const DataMapPair& dmPair )
{
return ( dmPair.second.first && dmPair.second.second.IsUnique() );
}
template <typename T> void DataManager<T> ::
CollectGarbage()
{
dataMap_.erase( remove_if( dataMap_.begin(), dataMap_.end(),
IsGarbage ), dataMap_.end() );
}
Can anyone tell how should I oveload that operator=? Or should I do
something else?