This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: compile errors
- From: LLeweLLyn Reese <llewelly at lifesupport dot shutdown dot com>
- To: Guohua Ma <maguohua at hpc dot me dot utexas dot edu>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 03 Mar 2003 05:26:16 -0800
- Subject: Re: compile errors
- References: <Pine.LNX.4.44.0302281155230.2587-100000@hpc10.me.utexas.edu>
- Reply-to: gcc-help at gcc dot gnu dot org
Guohua Ma <maguohua at hpc dot me dot utexas dot edu> writes:
> dear sir:
> I met some compiling problems when i use gcc3.2 to compile my program. my
> system is:
> redhat 8.0
> qt3-gcc3.2
> gcc 3.2
[snip]
> #ifndef PointerSwizzler_H
> #define PointerSwizzler_H
>
> #include <typeinfo>
> #include <map>
using std::type_info;
using std::pair;
using std::map;
should fix most of your errors.
>
> class PointerSwizzler {
> public:
> PointerSwizzler() ;
> ~PointerSwizzler() ;
>
> static unsigned long insert( void*, const type_info* ) ;
> static unsigned long find( void*, const type_info* ) ;
> static const type_info* find_type( void* ) ;
> unsigned long operator() ( void*, const type_info* ) const ;
>
> static void reset() ;
>
> protected:
> typedef pair<void*,const type_info*> KeyType ;
>
> struct ltptr {
> bool operator ()( KeyType a, KeyType b ) const
> {
> #if 0
> return ( (a.first < b.first) ||
> (a.first == b.first && a.second->before( *(b.second) ) ) )
> ;
> #else
> return ( a.first < b.first ) ;
> #endif
> }
> } ;
>
> typedef pair< const pair<void*,const type_info*>, unsigned long>
> ValueType ;
> typedef map< pair<void*,const type_info*>, unsigned long, ltptr >
> MapType ;
>
>
> static MapType s_swizzler ;
> static unsigned long s_current ;
> } ;
>
> template<class T>
> unsigned long swizzle_pointer( T* pointer )
> {
> const type_info* classid = &typeid( pointer ) ;
> return PointerSwizzler::insert( reinterpret_cast<void*>(pointer),
> classid ) ;
> }
>
> template<class T>
> unsigned long get_swizzle( T* pointer )
> {
> const type_info* classid = &typeid( pointer ) ;
> return PointerSwizzler::find( reinterpret_cast<void*>(pointer), classid
> ) ;
> }
>
> inline const type_info* find_type( void* pointer )
> { return PointerSwizzler::find_type( pointer ) ; }
>
> inline void reset_swizzler() { PointerSwizzler::reset() ; }
>
> #endif // PointerSwizzler_H
>
>
> I searched through internet, however i couldnot fix it. could you help me
> to fix it?
>
> guohua