DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   STL list question (http://www.daniweb.com/forums/thread165075.html)

dwhite409 Dec 30th, 2008 10:48 pm
STL list question
 
If you recall in the implementation of list:


struct list_node_base {
list_node_base* next
list_node_base* prev

...

void hook(const list_node_base*);

....
};

I wanted to look under the hood of the hook function, but can't find it anywhere in the STL library or any reference to this method via Google for that matter. All that Google pulls up are copies of <list>, which, duh, I'm looking at...

If you know how how the hook method works and could even just pseudo code it for me I'd appreciate it.

Much thanks

Ancient Dragon Dec 31st, 2008 1:14 am
Re: STL list question
 
why do you think that function is part of stl library?

ArkM Dec 31st, 2008 1:14 pm
Re: STL list question
 
it's not STL, it's libstdc++, list.cc module:
http://www.cs.brown.edu/~jwicks/libs...cc-source.html
00123   void
00124  _List_node_base::hook(_List_node_base* const __position)
00125  {
00126    this->_M_next = __position;
00127    this->_M_prev = __position->_M_prev;
00128    __position->_M_prev->_M_next = this;
00129    __position->_M_prev = this;
00130  }
;)

cikara21 Dec 31st, 2008 5:42 pm
Re: STL list question
 
<.................CLICK................>

dwhite409 Jan 3rd, 2009 12:51 pm
Re: STL list question
 
A ha! Thank you very much for your replies!


All times are GMT -4. The time now is 4:12 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC