C++ to C# static_cast -
i'm trying convert project c++ c# in c++ version following code used:
std::list<playerbase*>& allplayers = autolist<playerbase>::getallmembers();
and autolist header file folowwing
#ifndef autolist_h #define autolist_h #include <list> template <class t> class autolist { public: typedef std::list<t*> objectlist; private: static objectlist m_members; protected: autolist() { //cast object type t* , add list m_members.push_back(static_cast<t*>(this)); } ~autolist() { m_members.remove(static_cast<t*>(this)); } public: static objectlist& getallmembers(){return m_members;} }; template <class t> std::list<t*> autolist<t>::m_members; #endif
so how can make c# class can same me, selecting objects of class type: playerbase?
Comments
Post a Comment