bsnes/nall/vector/core.hpp
Tim Allen 3159285eaa Update to v106r68 release.
byuu says:

Changelog:

  - nall: converted range, iterator, vector to 64-bit
  - added (very poor) ColecoVision emulation (including Coleco Adam
    expansion)
  - added MSX skeleton
  - added Neo Geo Pocket skeleton
  - moved audio,video,resource folders into emulator folder
  - SFC heuristics: BS-X Town cart is "ZBSJ" [hex_usr]

The nall change is for future work on things like BPA: I need to be able
to handle files larger than 4GB. It is extremely possible that there are
still some truncations to 32-bit lurking around, and even more
disastrously, possibly some -1s lurking that won't sign-extend to
`(uint64_t)0-1`. There's a lot more classes left to do: `string`,
`array_view`, `array_span`, etc.
2018-12-22 21:28:15 +11:00

51 lines
1.2 KiB
C++

#pragma once
namespace nall {
template<typename T> vector<T>::vector(const initializer_list<T>& values) {
reserveRight(values.size());
for(auto& value : values) append(value);
}
template<typename T> vector<T>::vector(const vector<T>& source) {
operator=(source);
}
template<typename T> vector<T>::vector(vector<T>&& source) {
operator=(move(source));
}
template<typename T> vector<T>::~vector() {
reset();
}
template<typename T> vector<T>::operator bool() const {
return _size;
}
template<typename T> vector<T>::operator array_span<T>() {
return {data(), size()};
}
template<typename T> vector<T>::operator array_view<T>() const {
return {data(), size()};
}
template<typename T> template<typename Cast> auto vector<T>::capacity() const -> uint64_t {
return (_left + _size + _right) * sizeof(T) / sizeof(Cast);
}
template<typename T> template<typename Cast> auto vector<T>::size() const -> uint64_t {
return _size * sizeof(T) / sizeof(Cast);
}
template<typename T> template<typename Cast> auto vector<T>::data() -> Cast* {
return (Cast*)_pool;
}
template<typename T> template<typename Cast> auto vector<T>::data() const -> const Cast* {
return (const Cast*)_pool;
}
}