update queues for better stl complience

v1
Brett 2023-03-05 12:00:45 -05:00
parent bd89abb2f3
commit 48e126214b
2 changed files with 26 additions and 16 deletions

View File

@ -56,16 +56,16 @@ namespace blt {
} }
void pop() { void pop() {
if (isEmpty()) if (empty())
return; return;
m_insertIndex--; m_insertIndex--;
} }
bool isEmpty() { [[nodiscard]] inline bool empty() const {
return m_insertIndex <= 0; return m_insertIndex <= 0;
} }
int size() { [[nodiscard]] inline int size() const {
return m_insertIndex; return m_insertIndex;
} }
@ -106,8 +106,8 @@ namespace blt {
flat_queue(): m_data(new T[m_size]) { flat_queue(): m_data(new T[m_size]) {
} }
void push(const T& t) { inline void push(const T& t) {
if (m_insertIndex+1 >= m_size) { if (m_insertIndex+1 >= m_size) {
expand(); expand();
} }
@ -121,26 +121,26 @@ namespace blt {
[[nodiscard]] const T& front() const { [[nodiscard]] const T& front() const {
return m_data[m_headIndex]; return m_data[m_headIndex];
} }
void pop() { inline void pop() {
if (isEmpty()) if (empty())
return; return;
m_headIndex++; m_headIndex++;
} }
bool isEmpty() { [[nodiscard]] inline bool empty() const {
return m_headIndex >= m_size; return m_headIndex >= m_size;
} }
int size() { [[nodiscard]] inline int size() const {
return m_insertIndex - m_headIndex; return m_insertIndex - m_headIndex;
} }
T* begin(){ inline T* begin(){
return m_data[m_headIndex]; return m_data[m_headIndex];
} }
T* end(){ inline T* end(){
return m_data[m_insertIndex]; return m_data[m_insertIndex];
} }

View File

@ -42,6 +42,16 @@ namespace blt {
delete distribution; delete distribution;
} }
}; };
template<typename T>
class simplex_noise {
private:
public:
simplex_noise() {
}
};
} }
#endif //BLT_RANDOM_H #endif //BLT_RANDOM_H