I'm writing a class to manage memory for me (mostly for the experience though). Borland 5.5.1 for Windows is giving me a weird error. Here is the class:
In the definition file, this function is giving me the following error:Code:namespace MemoryManager { enum Option { printall = 1 }; // just one for now typedef map< void*, Object > pvomap; class Mgr { public: Mgr( Option opt = 0 ); template< class T > T* alloc( int = 1 ); template< class T > void dealloc( T* ); int allocated( const void* ptr ) const; template< class T > long bytes_allocated ( const T* ) const; long total_allocated() const; long total_bytes_allocated() const; protected: Option itsOptions; pvomap allPtrs; }; } // end namespace MemoryManager
Error E2094: 'operator+' not implemented in type 'pvomap' for arguments of type 'const void *'.
(This is the result of breaking down the steps. Originally the function was defined with one line: "return allPtrs[ptr].created();" but I broke it down to help me find the problem. I'm still stuck - I have no idea where the operator+ has anything to do with this...any help is appreciated. Thanks.Code:int Mgr::allocated( const void* ptr ) const { Object foo = allPtrs[ ptr ]; // error on this line int bar = foo.created(); return bar; }



LinkBack URL
About LinkBacks


