#pragma once namespace nall { template auto vector::fill(const T& value) -> void { for(uint n : range(size())) _pool[n] = value; } template auto vector::sort(const function& comparator) -> void { nall::sort(_pool, _size, comparator); } template auto vector::find(const function& comparator) -> maybe { for(uint n : range(size())) if(comparator(_pool[n])) return n; return nothing; } template auto vector::find(const T& value) const -> maybe { for(uint n : range(size())) if(_pool[n] == value) return n; return nothing; } template auto vector::findSorted(const T& value) const -> maybe { int l = 0, r = size() - 1; while(l <= r) { int m = l + (r - l >> 1); if(value == _pool[m]) return m; value < _pool[m] ? r = m - 1 : l = m + 1; } return nothing; } template auto vector::foreach(const function& callback) -> void { for(uint n : range(size())) callback(_pool[n]); } template auto vector::foreach(const function& callback) -> void { for(uint n : range(size())) callback(n, _pool[n]); } }