分类: C/C++
2012-06-09 15:53:20
- class dll_t;
- class dll_node_t
- {
- friend class dll_t;
- public:
- explicit dll_node_t ();
- void data (void *_p_data) {p_data_ = _p_data;}
- void *data () {return p_data_;}
- private:
- dll_node_t *prev_;
- dll_node_t *next_;
- void *p_data_;
- };
- class channel_t
- {
- public:
- channel_t () : node ()
- {
- node_.data (reinterpret_cast <void *> (this));
- }
- private:
- dll_node_t node_;
- };
- template <typename T_NODE> class dll_t;
- template <typename T_DATA> class dll_node_t
- {
- friend class dll_t
>; - public:
- explicit dll_node_t ();
- void data (T_DATA *_p_data) {p_data_ = _p_data;}
- T_DATA *data () {return p_data_;}
- private:
- dll_node_t *prev_;
- dll_node_t *next_;
- T_DATA *p_data_;
- };
- class channel_t
- {
- public:
- channel_t (): node_ ()
- {
- node_.data (this);
- }
- private:
- dll_node_t
node_; - };
本文出自李云的博客,请务必保留此出处:http://blog.chinaunix.net/uid-26470037-id-3237662.html。