1

rename Array to array

This commit is contained in:
2022-07-23 21:32:51 +02:00
parent 1788df7fad
commit c8db2c8878
3 changed files with 8 additions and 8 deletions

View File

@ -1,9 +1,9 @@
#include "user/demo/ArrayDemo.h" #include "user/demo/ArrayDemo.h"
void ArrayDemo::run() { void ArrayDemo::run() {
bse::Array<int, 10> arr1 {}; bse::array<int, 10> arr1 {};
bse::Array<int, 10> arr2 {}; bse::array<int, 10> arr2 {};
bse::Array<Thread*, 10> arr3 {}; bse::array<Thread*, 10> arr3 {};
kout.lock(); kout.lock();
kout.clear(); kout.clear();

View File

@ -86,7 +86,7 @@ void SmartPointerDemo::run() {
{ {
log.info() << "Stackallocating Array<bse::unique_ptr<int>, 10>..." << endl; log.info() << "Stackallocating Array<bse::unique_ptr<int>, 10>..." << endl;
bse::Array<bse::unique_ptr<int>, 10> arr; bse::array<bse::unique_ptr<int>, 10> arr;
log.info() << "Populating slot 0..." << endl; log.info() << "Populating slot 0..." << endl;
arr[0] = bse::make_unique<int>(1); arr[0] = bse::make_unique<int>(1);
log.info() << "Moving slot 0 to slot 1..." << endl; log.info() << "Moving slot 0 to slot 1..." << endl;
@ -97,7 +97,7 @@ void SmartPointerDemo::run() {
{ {
log.info() << "Heapallocating Array<bse::unique_ptr<int>, 10>..." << endl; log.info() << "Heapallocating Array<bse::unique_ptr<int>, 10>..." << endl;
bse::Array<bse::unique_ptr<int>, 10>* arr = new bse::Array<bse::unique_ptr<int>, 10>; bse::array<bse::unique_ptr<int>, 10>* arr = new bse::array<bse::unique_ptr<int>, 10>;
log.info() << "Populating slot 0..." << endl; log.info() << "Populating slot 0..." << endl;
(*arr)[0] = bse::make_unique<int>(1); (*arr)[0] = bse::make_unique<int>(1);
log.info() << "Moving slot 0 to slot 1..." << endl; log.info() << "Moving slot 0 to slot 1..." << endl;

View File

@ -8,7 +8,7 @@
namespace bse { namespace bse {
template<typename T, const std::size_t N> template<typename T, const std::size_t N>
class Array { class array {
public: public:
using Iterator = ContinuousIterator<T>; using Iterator = ContinuousIterator<T>;
@ -27,7 +27,7 @@ namespace bse {
return this->buf[i]; return this->buf[i];
} }
void swap(Array<T, N>& other) { void swap(array<T, N>& other) {
for (std::size_t i = 0; i < N; ++i) { for (std::size_t i = 0; i < N; ++i) {
std::swap(this->buf[i], other[i]); std::swap(this->buf[i], other[i]);
} }
@ -36,7 +36,7 @@ namespace bse {
// Array& other has to have size n: // Array& other has to have size n:
// arr1.swap_n<5>(arr2) => arr2 has size 5, arr1 has size >= 5 // arr1.swap_n<5>(arr2) => arr2 has size 5, arr1 has size >= 5
template<std::size_t n> template<std::size_t n>
void swap_n(Array<T, n>& other) { void swap_n(array<T, n>& other) {
for (std::size_t i = 0; i < n; ++i) { for (std::size_t i = 0; i < n; ++i) {
std::swap(this->buf[i], other[i]); std::swap(this->buf[i], other[i]);
} }