r warning C4312: 'type cast' : conversion from 'unsigned long' to 'void *' of greater size
下面是源码:
#ifndef COIN_SBINTLIST_H
#define COIN_SBINTLIST_H
#include <Inventor/lists/SbPList.h>
class COIN_DLL_API SbIntList : public SbPList {
public:
SbIntList(void) : SbPList () { }
SbIntList(const int sizehint) : SbPList(sizehint) { }
void append(const int item) {
((SbPList*)this)->append((void*)((unsigned long)item));
}
int find(const int item) {
return ((SbPList*)this)->find((void *)((unsigned long)item));
}
void insert(const int item, const int addbefore) {
((SbPList*)this)->insert((void *)((unsigned long)item), addbefore);
}
int & operator[](const int idx) const {
return (int&) ((*(const SbPList*)this)[idx]);
}
};
#endif // !COIN_SBINTLIST_H
其中红色部分产生了题目中的警告,不知道怎么去除警告,大家帮下吧?