2016-05-02 09:57:04 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace nall {
|
|
|
|
|
Update to v106r59 release.
byuu says:
Changelog:
- fixed bug in Emulator::Game::Memory::operator bool()
- nall: renamed view<string> back to `string_view`
- nall:: implemented `array_view`
- Game Boy: split cartridge-specific input mappings (rumble,
accelerometer) to their own separate ports
- Game Boy: fixed MBC7 accelerometer x-axis
- icarus: Game Boy, Super Famicom, Mega Drive cores output internal
header game titles to heuristics manifests
- higan, icarus, hiro/gtk: improve viewport geometry configuration;
fixed higan crashing bug with XShm driver
- higan: connect Video::poll(),update() functionality
- hiro, ruby: several compilation / bugfixes, should get the macOS
port compiling again, hopefully [Sintendo]
- ruby/video/xshm: fix crashing bug on window resize
- a bit hacky; it's throwing BadAccess Xlib warnings, but they're
not fatal, so I am catching and ignoring them
- bsnes: removed Application::Windows::onModalChange hook that's no
longer needed [Screwtape]
2018-08-26 06:49:54 +00:00
|
|
|
template<typename T> auto vector<T>::fill(const T& value) -> void {
|
2018-12-22 10:28:15 +00:00
|
|
|
for(uint64_t n : range(size())) _pool[n] = value;
|
Update to v106r59 release.
byuu says:
Changelog:
- fixed bug in Emulator::Game::Memory::operator bool()
- nall: renamed view<string> back to `string_view`
- nall:: implemented `array_view`
- Game Boy: split cartridge-specific input mappings (rumble,
accelerometer) to their own separate ports
- Game Boy: fixed MBC7 accelerometer x-axis
- icarus: Game Boy, Super Famicom, Mega Drive cores output internal
header game titles to heuristics manifests
- higan, icarus, hiro/gtk: improve viewport geometry configuration;
fixed higan crashing bug with XShm driver
- higan: connect Video::poll(),update() functionality
- hiro, ruby: several compilation / bugfixes, should get the macOS
port compiling again, hopefully [Sintendo]
- ruby/video/xshm: fix crashing bug on window resize
- a bit hacky; it's throwing BadAccess Xlib warnings, but they're
not fatal, so I am catching and ignoring them
- bsnes: removed Application::Windows::onModalChange hook that's no
longer needed [Screwtape]
2018-08-26 06:49:54 +00:00
|
|
|
}
|
|
|
|
|
2016-05-02 09:57:04 +00:00
|
|
|
template<typename T> auto vector<T>::sort(const function<bool (const T& lhs, const T& rhs)>& comparator) -> void {
|
|
|
|
nall::sort(_pool, _size, comparator);
|
|
|
|
}
|
|
|
|
|
2018-10-04 10:11:23 +00:00
|
|
|
template<typename T> auto vector<T>::reverse() -> void {
|
|
|
|
vector<T> reversed;
|
2018-12-22 10:28:15 +00:00
|
|
|
for(uint64_t n : range(size())) reversed.prepend(_pool[n]);
|
2018-10-04 10:11:23 +00:00
|
|
|
operator=(move(reversed));
|
|
|
|
}
|
|
|
|
|
2018-12-22 10:28:15 +00:00
|
|
|
template<typename T> auto vector<T>::find(const function<bool (const T& lhs)>& comparator) -> maybe<uint64_t> {
|
|
|
|
for(uint64_t n : range(size())) if(comparator(_pool[n])) return n;
|
2018-08-04 11:44:00 +00:00
|
|
|
return nothing;
|
|
|
|
}
|
|
|
|
|
2018-12-22 10:28:15 +00:00
|
|
|
template<typename T> auto vector<T>::find(const T& value) const -> maybe<uint64_t> {
|
|
|
|
for(uint64_t n : range(size())) if(_pool[n] == value) return n;
|
2016-05-02 09:57:04 +00:00
|
|
|
return nothing;
|
|
|
|
}
|
|
|
|
|
2018-12-22 10:28:15 +00:00
|
|
|
template<typename T> auto vector<T>::findSorted(const T& value) const -> maybe<uint64_t> {
|
|
|
|
int64_t l = 0, r = size() - 1;
|
2018-08-21 03:17:12 +00:00
|
|
|
while(l <= r) {
|
2018-12-22 10:28:15 +00:00
|
|
|
int64_t m = l + (r - l >> 1);
|
2018-08-21 03:17:12 +00:00
|
|
|
if(value == _pool[m]) return m;
|
|
|
|
value < _pool[m] ? r = m - 1 : l = m + 1;
|
|
|
|
}
|
|
|
|
return nothing;
|
|
|
|
}
|
|
|
|
|
2018-08-04 11:44:00 +00:00
|
|
|
template<typename T> auto vector<T>::foreach(const function<void (const T&)>& callback) -> void {
|
2018-12-22 10:28:15 +00:00
|
|
|
for(uint64_t n : range(size())) callback(_pool[n]);
|
2018-08-04 11:44:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> auto vector<T>::foreach(const function<void (uint, const T&)>& callback) -> void {
|
2018-12-22 10:28:15 +00:00
|
|
|
for(uint64_t n : range(size())) callback(n, _pool[n]);
|
2018-08-04 11:44:00 +00:00
|
|
|
}
|
|
|
|
|
2016-05-02 09:57:04 +00:00
|
|
|
}
|