mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 11:02:43 +00:00 
			
		
		
		
	 8bb9fe63b7
			
		
	
	
		8bb9fe63b7
		
	
	
	
	
		
			
			This abstracts a vector of Cell* with a strongly typed span() accessor that gives you Span<T*> instead of Span<Cell*>. It is intended to replace MarkedValueList in situations where you only need to store pointers to Cell (or an even more specific type of Cell). The API can definitely be improved, it's just the bare basics for now.
		
			
				
	
	
		
			30 lines
		
	
	
	
		
			584 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			584 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibJS/Heap/Heap.h>
 | |
| #include <LibJS/Heap/MarkedVector.h>
 | |
| 
 | |
| namespace JS {
 | |
| 
 | |
| MarkedVectorBase::MarkedVectorBase(Heap& heap)
 | |
|     : m_heap(heap)
 | |
| {
 | |
|     m_heap.did_create_marked_vector({}, *this);
 | |
| }
 | |
| 
 | |
| MarkedVectorBase::MarkedVectorBase(MarkedVectorBase&& other)
 | |
|     : m_heap(other.m_heap)
 | |
|     , m_cells(move(other.m_cells))
 | |
| {
 | |
|     m_heap.did_create_marked_vector({}, *this);
 | |
| }
 | |
| 
 | |
| MarkedVectorBase::~MarkedVectorBase()
 | |
| {
 | |
|     m_heap.did_destroy_marked_vector({}, *this);
 | |
| }
 | |
| 
 | |
| }
 |