Index: src/examples/gc_no_raii/bug-repro/find.c
===================================================================
--- src/examples/gc_no_raii/bug-repro/find.c	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
+++ src/examples/gc_no_raii/bug-repro/find.c	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -0,0 +1,10 @@
+
+void main()
+{
+	int a[3] = {1, 2, 3};
+	int* begin = a;
+	int *const end = begin + 3;
+
+	int* f = find(begin, &end, 2);
+
+}
Index: src/examples/gc_no_raii/bug-repro/inline.c
===================================================================
--- src/examples/gc_no_raii/bug-repro/inline.c	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
+++ src/examples/gc_no_raii/bug-repro/inline.c	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -0,0 +1,8 @@
+inline _Bool test(int t){
+	return t == 3;
+}
+
+int main()
+{
+	test(6);
+}
Index: src/examples/gc_no_raii/bug-repro/push_back.c
===================================================================
--- src/examples/gc_no_raii/bug-repro/push_back.c	(revision 9026b4bd5c43c59398acda20eae069396557e348)
+++ src/examples/gc_no_raii/bug-repro/push_back.c	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -2,47 +2,15 @@
 #include <stdint.h>
 
-//------------------------------------------------------------------------------
-//Declaration
-trait allocator_c(otype T, otype allocator_t) {
-	void realloc(allocator_t*, size_t);
-	T* data(allocator_t*);
-};
-
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-struct vector
-{
-	allocator_t storage;
-	size_t size;
-};
-
-//------------------------------------------------------------------------------
-//Allocator
-forall(otype T)
-struct heap_allocator
-{
-	T* storage;
-	size_t capacity;
-};
-
-forall(otype T)
-void realloc(heap_allocator(T)* this, size_t size);
-
-forall(otype T)
-inline T* data(heap_allocator(T)* this)
-{
-	return this->storage;
-}
-
-//------------------------------------------------------------------------------
-//Modifiers
-forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-void push_back(vector(T, allocator_t)* this, T value);
+#include "push_back.h"
 
 typedef vector(intptr_t*, heap_allocator(intptr_t*)) worklist_t;
 
-inline void test()
+void test()
 {
 	worklist_t w;
-	intptr_t zero = 0;
-	push_back(&w, &zero);
+	if(!empty(&w))
+	{
+		intptr_t zero = 0;
+		push_back(&w, &zero);
+	}
 }
Index: src/examples/gc_no_raii/bug-repro/push_back.h
===================================================================
--- src/examples/gc_no_raii/bug-repro/push_back.h	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
+++ src/examples/gc_no_raii/bug-repro/push_back.h	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -0,0 +1,72 @@
+//------------------------------------------------------------------------------
+//Declaration
+trait allocator_c(otype T, otype allocator_t) {
+	void ctor(allocator_t* const);
+	void dtor(allocator_t* const);
+	void realloc(allocator_t* const, size_t);
+	T* data(allocator_t* const);
+};
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+struct vector
+{
+	allocator_t storage;
+	size_t size;
+};
+
+//------------------------------------------------------------------------------
+//Initialization
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void vector_ctor(vector(T, allocator_t) *const this);
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void dtor(vector(T, allocator_t) *const this);
+
+//------------------------------------------------------------------------------
+//Allocator
+forall(otype T)
+struct heap_allocator
+{
+	T* storage;
+	size_t capacity;
+};
+
+forall(otype T)
+void ctor(heap_allocator(T) *const this);
+
+forall(otype T)
+void dtor(heap_allocator(T) *const this);
+
+forall(otype T)
+void realloc(heap_allocator(T) *const this, size_t size);
+
+forall(otype T)
+inline T* data(heap_allocator(T) *const this)
+{
+	return this->storage;
+}
+
+//------------------------------------------------------------------------------
+//Capacity
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline bool empty(vector(T, allocator_t) *const this)
+{
+	return this->size == 0;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline bool size(vector(T, allocator_t) *const this)
+{
+	return this->size;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline void reserve(vector(T, allocator_t) *const this, size_t size)
+{
+	realloc(&this->storage, this->size+1);
+}
+
+//------------------------------------------------------------------------------
+//Modifiers
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void push_back(vector(T, allocator_t) *const this, T value);
Index: src/examples/gc_no_raii/src/internal/collector.c
===================================================================
--- src/examples/gc_no_raii/src/internal/collector.c	(revision 9026b4bd5c43c59398acda20eae069396557e348)
+++ src/examples/gc_no_raii/src/internal/collector.c	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -67,5 +67,5 @@
 	check(((intptr_t)data) + target_size <= ((intptr_t)block) + actual_size);
 
-	gc_object_header* obj = gc_object_header_placement_ctor(header, actual_size);
+	gc_object_header* obj = placement_ctor(header, actual_size);
 
 	(void)obj; //remove unsused warning since this is for debug
@@ -119,5 +119,5 @@
 	memcpy(new_block, ptr, ptr->size);
 
-	gc_object_header* fwd_ptr = gc_object_header_placement_copy_ctor(new_block, ptr);
+	gc_object_header* fwd_ptr = placement_copy_ctor(new_block, ptr);
 
 	ptr->forward = fwd_ptr;
Index: src/examples/gc_no_raii/src/internal/memory_pool.h
===================================================================
--- src/examples/gc_no_raii/src/internal/memory_pool.h	(revision 9026b4bd5c43c59398acda20eae069396557e348)
+++ src/examples/gc_no_raii/src/internal/memory_pool.h	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -53,4 +53,7 @@
 bool ?!=?(const gc_pool_object_iterator lhs, const gc_pool_object_iterator rhs);
 
+gc_pool_object_iterator begin(gc_memory_pool* const);
+gc_pool_object_iterator end(gc_memory_pool* const);
+
 gc_pool_object_iterator* ++?(gc_pool_object_iterator* it);
 
Index: src/examples/gc_no_raii/src/internal/object_header.c
===================================================================
--- src/examples/gc_no_raii/src/internal/object_header.c	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
+++ src/examples/gc_no_raii/src/internal/object_header.c	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -0,0 +1,93 @@
+#include "object_header.h"
+
+#include <stdint.h>
+
+#include "globals.h"
+#include "gcpointers.h"
+
+placement_copy_ctor(void* address, const gc_object_header* const other)
+{
+	gc_object_header* const this = (gc_object_header*)address;
+	#if _DEBUG
+		this->canary_start = CANARY_VALUE;
+	#endif
+	this->size = other->size;
+	this->root_chain = other->root_chain;
+	this->type_chain = NULL;
+	this->forward = NULL;
+	this->is_forwarded = false;
+	#if _DEBUG
+		this->canary_end = CANARY_VALUE;
+	#endif
+	{
+		gcpointer_t* root = this->root_chain;
+		while(root)
+		{
+			check(get_object_ptr(root->ptr) == other);
+			intptr_t int_this = (intptr_t)this;
+			intptr_t int_next = int_this + sizeof(gc_object_header);
+			intptr_t* root_ptr = root->ptr;
+			*root_ptr = int_next;
+
+			check(get_object_ptr(root->ptr) == this);
+			root = root->next;
+		}
+
+		gcpointer_t* type = other->type_chain;
+
+		while(type)
+		{
+			check((intptr_t)type < (intptr_t)((intptr_t)other + other->size));
+
+			size_t offset = (intptr_t)type - (intptr_t)other;
+			check(offset < size);
+
+			gcpointer_t* member_ptr = (gcpointer_t*)( (intptr_t)this + offset );
+
+			if(!this->type_chain) this->type_chain = member_ptr;
+
+			size_t next_offset = type->next ? (intptr_t)type->next - (intptr_t)other : 0;
+			check(next_offset < size);
+
+			gcpointer_t* next_ptr = type->next ? (gcpointer_t*)((intptr_t)this + next_offset) : NULL;
+
+			member_ptr->ptr = type->ptr;
+			member_ptr->next = next_ptr;
+
+			type = type->next;
+		}
+
+		check(is_valide(this));
+	}
+}
+
+#if _DEBUG
+	bool is_valide(const gc_object_header* const this)
+	{
+		check(this->canary_start == CANARY_VALUE);
+		check(this->canary_end == CANARY_VALUE);
+
+		check(this->is_forwarded == (this->forward != nullptr));
+
+		check(this->size < POOL_SIZE_BYTES);
+
+		gcpointer_t* root = this->root_chain;
+		while(root)
+		{
+			check(get_object_ptr(root->ptr) == this);
+
+			root = root->next;
+		}
+
+		gcpointer_t* type = type_chain;
+		while(type)
+		{
+			check((intptr_t)type > (intptr_t)this);
+			check((intptr_t)type < (intptr_t)((intptr_t)this + size));
+
+			type = type->next;
+		}
+
+		return true;
+	}
+#endif
Index: src/examples/gc_no_raii/src/internal/object_header.h
===================================================================
--- src/examples/gc_no_raii/src/internal/object_header.h	(revision 9026b4bd5c43c59398acda20eae069396557e348)
+++ src/examples/gc_no_raii/src/internal/object_header.h	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -30,4 +30,4 @@
 };
 
-gc_object_header* gc_object_header_placement_ctor(void* address, size_t size);
-gc_object_header* gc_object_header_placement_copy_ctor(void* address, gc_object_header* other);
+gc_object_header* placement_ctor(void* address, size_t size);
+gc_object_header* placement_copy_ctor(void* address, const gc_object_header* const other);
Index: src/examples/gc_no_raii/src/internal/state.c
===================================================================
--- src/examples/gc_no_raii/src/internal/state.c	(revision 9026b4bd5c43c59398acda20eae069396557e348)
+++ src/examples/gc_no_raii/src/internal/state.c	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -1,5 +1,5 @@
 #include "state.h"
 
-#include <stdlib.h>
+#include <stdlib>
 
 //general purpouse includes
@@ -28,9 +28,9 @@
 {
 	static gc_state s;
-	if(!s.is_initialized) gc_state_ctor(&s);
+	if(!s.is_initialized) ctor(&s);
 	return &s;
 }
 
-void gc_state_ctor(gc_state *const this)
+void ctor(gc_state *const this)
 {
 	this->from_code = 0;
@@ -39,5 +39,5 @@
 	this->total_space = 0;
 	this->used_space = 0;
-	// state->pools_table();
+	ctor(&this->pools_table);
 
 	gc_allocate_pool(this);
@@ -46,53 +46,53 @@
 }
 
-// bool state::is_in_heap(void* address) const
-// {
-// 	memory_pool* target_pool = gc_pool_of(address);
-//
-// 	auto first = pools_table.cbegin();
-// 	auto last = pools_table.cend();
-// 	auto result = std::find(first, last, target_pool);
-// 	return result != last && (*result)->is_from_space();
-// }
-
-// bool state::is_in_to_space(void* address) const
-// {
-// 	const memory_pool* target_pool = pool_of(address);
-//
-// 	auto first = pools_table.cbegin();
-// 	auto last = pools_table.cend();
-// 	auto result = std::find(first, last, target_pool);
-// 	return result != last && !(*result)->is_from_space();
-// }
-//
-// gc_object_header* gc_get_object_for_ref(gc_state* state, void* member)
-// {
-// 	intptr_t target = ((intptr_t)member);
-// 	if(!gc_is_in_heap(state, member)) return NULL;
-//
-// 	gc_memory_pool* pool = gc_pool_of(member);
-// 	gc_pool_object_iterator it = gc_pool_iterator_for(pool, member);
-// 	gc_pool_object_iterator end = gc_pool_end(pool);
-//
-// 	while(it != end)
-// 	{
-// 		gc_object_header* object = *it;
-// 		{
-// 			intptr_t start = ((intptr_t)object);
-// 			intptr_t end = ((intptr_t)start + object->size);
-// 			if(start < target && end > target)
-// 			{
-// 				return object;
-// 			}
-// 		}
-// 		++it;
-// 	}
-//
-// 	checkf(false, "is_in_heap() and iterator_for() return inconsistent data");
-// 	abort();
-// 	return NULL;
-// }
-
-void* gc_state_try_allocate(gc_state *const this, size_t size)
+bool gc_state_is_in_heap(const gc_state* const this, void* address)
+{
+	gc_memory_pool* target_pool = gc_pool_of(address);
+
+	gc_memory_pool** first = cbegin(&this->pools_table);
+	gc_memory_pool** last = cend(&this->pools_table);
+	gc_memory_pool** result = find(first, &last, target_pool);
+	return result != last && gc_pool_is_from_space(*result);
+}
+
+bool gc_state_is_in_to_space(const gc_state* const this, void* address)
+{
+	gc_memory_pool* target_pool = gc_pool_of(address);
+
+	gc_memory_pool** first = cbegin(&this->pools_table);
+	gc_memory_pool** last = cend(&this->pools_table);
+	gc_memory_pool** result = find(first, &last, target_pool);
+	return result != last && !gc_pool_is_from_space(*result);
+}
+
+gc_object_header* gc_get_object_for_ref(gc_state* state, void* member)
+{
+	intptr_t target = ((intptr_t)member);
+	if(!gc_is_in_heap(state, member)) return NULL;
+
+	gc_memory_pool* pool = gc_pool_of(member);
+	gc_pool_object_iterator it = gc_pool_iterator_for(pool, member);
+	gc_pool_object_iterator end = gc_pool_end(pool);
+
+	while(it != end)
+	{
+		gc_object_header* object = *it;
+		{
+			intptr_t start = ((intptr_t)object);
+			intptr_t end = ((intptr_t)start + object->size);
+			if(start < target && end > target)
+			{
+				return object;
+			}
+		}
+		++it;
+	}
+
+	checkf(false, "is_in_heap() and iterator_for() return inconsistent data");
+	abort();
+	return NULL;
+}
+
+void* gc_try_allocate(gc_state *const this, size_t size)
 {
 	gc_memory_pool* pool = this->from_space;
@@ -122,9 +122,9 @@
 	this->total_space += gc_pool_size_used(this->from_space);
 
-	// pools_table.push_back(from_space);
-	// pools_table.push_back(to_space);
-}
-
-void gc_state_collect(gc_state *const this)
+	push_back(&this->pools_table, this->from_space);
+	push_back(&this->pools_table, this->to_space);
+}
+
+void gc_state_collect(gc_state* const this)
 {
 	// DEBUG("collecting");
@@ -132,155 +132,161 @@
 
 	worklist_t worklist;
-	// vector_ctor(&worklist);
+	ctor(&worklist);
 	gc_state_sweep_roots(this, &worklist);
 
 	while(!empty(&worklist))
 	{
-		void** ref = back(&worklist);
+		intptr_t* ref = back(&worklist);
 		pop_back(&worklist);
-		gc_state_process_reference(this, ref, &worklist);
-	}
-	//
-	// check(gc_state_roots_match(this));
-	// check(gc_state_no_from_space_ref(this));
-	//
-	// gc_state_swap(this);
-	//
-	// gc_state_calc_usage(this);
-	//
-	// if(gc_state_needs_collect(this)) gc_state_allocate_pool(this);
+		gc_process_reference((void**)ref, &worklist);
+	}
+
+	check(gc_state_roots_match(this));
+	check(gc_state_no_from_space_ref(this));
+
+	gc_state_swap(this);
+
+	gc_state_calc_usage(this);
+
+	if(gc_needs_collect(this)) gc_state_allocate_pool(this);
 
 	// DEBUG("done");
-	// dtor(&worklist);
-}
-//
-// void state::swap()
-// {
-// 	std::swap(from_space, to_space);
-//
-// 	memory_pool* pool = to_space;
-// 	while(pool)
-// 	{
-// 		pool->reset();
-// 		pool = pool->next();
-// 	}
-//
-// 	from_code = (~from_code) & 0x01;
-//
-// 	#if _DEBUG
-// 		{
-// 			memory_pool* pool = from_space;
-// 			while(pool)
-// 			{
-// 				check(pool->is_from_space());
-// 				pool = pool->next();
-// 			}
-//
-// 			pool = to_space;
-// 			while(pool)
-// 			{
-// 				check(!pool->is_from_space());
-// 				pool = pool->next();
-// 			}
-// 		}
-// 	#endif
-// }
-//
-// void state::sweep_roots(std::vector<void**>& worklist)
-// {
-// 	memory_pool* pool = from_space;
-// 	while(pool)
-// 	{
-// 		for(object_header* object : *pool)
-// 		{
-// 			if(!object->root_chain) continue;
-//
-// 			copy_object(object);
-//
-// 			scan_object(object->forward, worklist);
-// 		}
-//
-// 		pool = pool->next();
-// 	}
-// }
-//
-// void state::clear()
-// {
-// 	memory_pool* pool = from_space;
-// 	while(pool)
-// 	{
-// 		pool->reset();
-// 		pool = pool->next();
-// 	}
-//
-// 	pool = to_space;
-// 	while(pool)
-// 	{
-// 		pool->reset();
-// 		pool = pool->next();
-// 	}
-// }
-//
-// void state::calc_usage()
-// {
-// 	total_space = 0;
-// 	used_space = 0;
-//
-// 	memory_pool* pool = from_space;
-// 	while(pool)
-// 	{
-// 		size_t size = pool->size();
-// 		size_t used = size - pool->size_left();
-// 		check(used <= size);
-// 		total_space += size;
-// 		used_space += used;
-//
-// 		pool = pool->next();
-// 	}
-// }
-//
-// #if _DEBUG
-// 	bool state::roots_match()
-// 	{
-// 		memory_pool* pool = to_space;
-// 		while(pool)
-// 		{
-// 			size_t size = 0;
-// 			for(object_header* object : *pool)
-// 			{
-// 				size += object->size;
-//
-// 				gcpointer_base* ptr = object->root_chain;
-// 				while(ptr)
-// 				{
-// 					check(get_object_ptr(ptr->m_ptr) == object);
-// 					ptr = ptr->m_next;
-// 				}
-// 			}
-//
-// 			check(size + pool->size_left() == pool->size());
-//
-// 			pool = pool->next();
-// 		}
-//
-// 		return true;
-// 	}
-//
-// 	bool state::no_from_space_ref()
-// 	{
-// 		memory_pool* pool = to_space;
-// 		while(pool)
-// 		{
-// 			void** potential_ref = (void**)pool->m_start;
-// 			while(potential_ref < (void**)pool->m_free)
-// 			{
-// 				check(!is_in_heap(*potential_ref));
-// 				potential_ref++;
-// 			}
-//
-// 			pool = pool->next();
-// 		}
-//
-// 		return true;
-// 	}
-// #endif
+	dtor(&worklist);
+}
+
+void gc_state_swap(gc_state* const this)
+{
+	swap(&this->from_space, &this->to_space);
+
+	gc_memory_pool* pool = this->to_space;
+	while(pool)
+	{
+		gc_reset_pool(pool);
+		pool = pool->next;
+	}
+
+	this->from_code = (~this->from_code) & 0x01;
+
+	#if _DEBUG
+		{
+			gc_memory_pool* pool = this->from_space;
+			while(pool)
+			{
+				check(gc_pool_is_from_space(pool));
+				pool = pool->next;
+			}
+
+			pool = this->to_space;
+			while(pool)
+			{
+				check(!gc_pool_is_from_space(pool));
+				pool = pool->next;
+			}
+		}
+	#endif
+}
+
+void gc_state_sweep_roots(gc_state* const this, worklist_t* worklist)
+{
+	gc_memory_pool* pool = this->from_space;
+	while(pool)
+	{
+		gc_pool_object_iterator it = begin(pool);
+		gc_pool_object_iterator end = end(pool);
+		for(;it != end; ++it)
+		{
+			gc_object_header* object = *it;
+			if(!object->root_chain) continue;
+
+			gc_copy_object(object);
+
+			gc_scan_object(object->forward, worklist);
+		}
+
+		pool = pool->next;
+	}
+}
+
+void gc_state_clear(gc_state* const this)
+{
+	gc_memory_pool* pool = this->from_space;
+	while(pool)
+	{
+		gc_reset_pool(pool);
+		pool = pool->next;
+	}
+
+	pool = this->to_space;
+	while(pool)
+	{
+		gc_reset_pool(pool);
+		pool = pool->next;
+	}
+}
+
+void gc_state_calc_usage(gc_state* const this)
+{
+	this->total_space = 0;
+	this->used_space = 0;
+
+	gc_memory_pool* pool = this->from_space;
+	while(pool)
+	{
+		size_t size = gc_pool_size_total(pool);
+		size_t used = gc_pool_size_used(pool);
+		check(used <= size);
+		this->total_space += size;
+		this->used_space += used;
+
+		pool = pool->next;
+	}
+}
+
+#if _DEBUG
+	bool gc_state_roots_match(gc_state* const this)
+	{
+		gc_memory_pool* pool = this->to_space;
+		while(pool)
+		{
+			size_t size = 0;
+			gc_pool_object_iterator it = begin(pool);
+			gc_pool_object_iterator end = end(pool);
+			for(;it != end; ++it)
+			{
+				gc_object_header* object = *it;
+				size += object->size;
+
+				gcpointer_base* ptr = object->root_chain;
+				while(ptr)
+				{
+					check(get_object_ptr(ptr->m_ptr) == object);
+					ptr = ptr->m_next;
+				}
+			}
+
+			check(size + gc_pool_size_used(pool) == gc_pool_size_total(pool));
+
+			pool = pool->next;
+		}
+
+		return true;
+	}
+
+	bool gc_state_no_from_space_ref(gc_state* const this)
+	{
+		gc_memory_pool* pool = this->to_space;
+		while(pool)
+		{
+			void** potential_ref = (void**)pool->m_start;
+			while(potential_ref < (void**)pool->m_free)
+			{
+				check(!gc_is_in_heap(*potential_ref));
+				potential_ref++;
+			}
+
+			pool = pool->next;
+		}
+
+		return true;
+	}
+#endif
Index: src/examples/gc_no_raii/src/internal/state.h
===================================================================
--- src/examples/gc_no_raii/src/internal/state.h	(revision 9026b4bd5c43c59398acda20eae069396557e348)
+++ src/examples/gc_no_raii/src/internal/state.h	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -5,4 +5,7 @@
 
 #include "tools.h"
+#include "vector.h"
+
+typedef vector(struct gc_memory_pool*, heap_allocator(struct gc_memory_pool*)) pools_table_t;
 
 struct gc_state
@@ -16,9 +19,9 @@
 	size_t used_space;
 
-	// const struct memory_pool* 	pools_table;
-	// size_t 				pools_table_count;
+	pools_table_t 	pools_table;
+	size_t 		pools_table_count;
 };
 
-void gc_state_ctor(struct gc_state* state);
+void ctor(struct gc_state* state);
 
 gc_state* gc_get_state();
@@ -39,7 +42,7 @@
 bool gc_is_in_to_space(const gc_state* state, void* address);
 
-inline uint8_t gc_from_space_code(const gc_state* state)
+inline uint8_t gc_from_space_code(const gc_state *const this)
 {
-	return state->from_code;
+	return this->from_code;
 }
 
Index: src/examples/gc_no_raii/src/tools.h
===================================================================
--- src/examples/gc_no_raii/src/tools.h	(revision 9026b4bd5c43c59398acda20eae069396557e348)
+++ src/examples/gc_no_raii/src/tools.h	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -3,2 +3,35 @@
 #include "tools/checks.h"
 #include "tools/print.h"
+
+// forall(otype T)
+// inline void swap(T* const a, T* const b)
+// {
+// 	T* temp = a;
+// 	*a = *b;
+// 	*b = *temp;
+// }
+
+trait has_equal(otype T)
+{
+	signed int ?==?(T a, T b);
+};
+
+trait InputIterator_t(otype T, otype InputIterator)
+{
+	signed int ?==?(InputIterator a, InputIterator b);
+	signed int ?!=?(InputIterator a, InputIterator b);
+	T *?(InputIterator a);
+	InputIterator ++?(InputIterator* a);
+	InputIterator ?++(InputIterator* a);
+};
+
+forall(otype T | has_equal(T), otype InputIterator | InputIterator_t(T, InputIterator))
+inline InputIterator find( InputIterator first, const InputIterator* const last, T val)
+{
+	while ( first != *last)
+	{
+		if(*first == val) return first;
+		++first;
+	}
+	return *last;
+}
Index: src/examples/gc_no_raii/src/tools/print.h
===================================================================
--- src/examples/gc_no_raii/src/tools/print.h	(revision 9026b4bd5c43c59398acda20eae069396557e348)
+++ src/examples/gc_no_raii/src/tools/print.h	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -3,7 +3,5 @@
 #if _DEBUG
 
-#include "fstream.h"
-
-extern ofstream *sout;
+#include <fstream>
 
 #define DEBUG_OUT(x) sout | x | endl;
Index: src/examples/gc_no_raii/src/vector.h
===================================================================
--- src/examples/gc_no_raii/src/vector.h	(revision 9026b4bd5c43c59398acda20eae069396557e348)
+++ src/examples/gc_no_raii/src/vector.h	(revision df4aea7ba7f621d92d959bff25f0126d5b820869)
@@ -1,2 +1,4 @@
+#pragma once
+
 #include <assert.h>
 #include <stdbool.h>
@@ -8,9 +10,10 @@
 //------------------------------------------------------------------------------
 //Declaration
-trait allocator_c(otype T, otype allocator_t) {
-	void ctor(allocator_t*);
-	void dtor(allocator_t*);
-	void realloc(allocator_t*, size_t);
-	T* data(allocator_t*);
+trait allocator_c(otype T, otype allocator_t)
+{
+	void ctor(allocator_t* const);
+	void dtor(allocator_t* const);
+	void realloc(allocator_t* const, size_t);
+	T* data(allocator_t* const);
 };
 
@@ -25,5 +28,5 @@
 //Initialization
 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-void vector_ctor(vector(T, allocator_t) *const this);
+void ctor(vector(T, allocator_t) *const this);
 
 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
@@ -72,5 +75,5 @@
 
 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
-inline T back(vector(T, allocator_t) *const this, size_t index)
+inline T back(vector(T, allocator_t) *const this)
 {
 	return data(&this->storage)[this->size - 1];
@@ -87,4 +90,30 @@
 forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
 void clear(vector(T, allocator_t) *const this);
+
+//------------------------------------------------------------------------------
+//Iterators
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline T* begin(vector(T, allocator_t) *const this)
+{
+	return data(&this->storage);
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline const T* cbegin(const vector(T, allocator_t) *const this)
+{
+	return data(&this->storage);
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline T* end(vector(T, allocator_t) *const this)
+{
+	return data(&this->storage) + this->size;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline const T* cend(const vector(T, allocator_t) *const this)
+{
+	return data(&this->storage) + this->size;
+}
 
 //------------------------------------------------------------------------------
