V
Vincent RICHOMME
Hi,
I would like to port a .NET list into standard c++
and in particular is there a way of knowing if the object is a pointer
or not ?
Ex :
template<typename T>
class List : public std::list<T>
{
public:
~List() { Clear(); }
inline void Add(T object)
{
// IS IT POSSIBLE TO KNOW if object is a pointer ???????????
if ( ISAPONITER(object) )
bIsPtr = true;
else
bIsPtr = false;
push_back(object);
}
inline void Clear(bool bDeallocate = true)
{
if (bDeallocate && m_bIsPtr)
{
int count = this->size();
// ???? I SHOULD PARSE MY LIST AND DEALLOCATE
this->std::list<T>::clear();
}
}
inline int GetCount() { return size(); }
private:
bool m_bIsPtr;
};
I would like to port a .NET list into standard c++
and in particular is there a way of knowing if the object is a pointer
or not ?
Ex :
template<typename T>
class List : public std::list<T>
{
public:
~List() { Clear(); }
inline void Add(T object)
{
// IS IT POSSIBLE TO KNOW if object is a pointer ???????????
if ( ISAPONITER(object) )
bIsPtr = true;
else
bIsPtr = false;
push_back(object);
}
inline void Clear(bool bDeallocate = true)
{
if (bDeallocate && m_bIsPtr)
{
int count = this->size();
// ???? I SHOULD PARSE MY LIST AND DEALLOCATE
this->std::list<T>::clear();
}
}
inline int GetCount() { return size(); }
private:
bool m_bIsPtr;
};