mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	AK: Add IntrusiveList::take_last()
This commit is contained in:
		
							parent
							
								
									3e3a72f2a2
								
							
						
					
					
						commit
						c33d71c5ff
					
				
					 2 changed files with 25 additions and 13 deletions
				
			
		|  | @ -56,6 +56,7 @@ public: | |||
|     T* last() const; | ||||
| 
 | ||||
|     T* take_first(); | ||||
|     T* take_last(); | ||||
| 
 | ||||
|     class Iterator { | ||||
|     public: | ||||
|  | @ -233,6 +234,16 @@ inline T* IntrusiveList<T, member>::take_first() | |||
|     return nullptr; | ||||
| } | ||||
| 
 | ||||
| template<class T, IntrusiveListNode T::*member> | ||||
| inline T* IntrusiveList<T, member>::take_last() | ||||
| { | ||||
|     if (auto* ptr = last()) { | ||||
|         remove(*ptr); | ||||
|         return ptr; | ||||
|     } | ||||
|     return nullptr; | ||||
| } | ||||
| 
 | ||||
| template<class T, IntrusiveListNode T::*member> | ||||
| inline T* IntrusiveList<T, member>::last() const | ||||
| { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling