initial commit
This commit is contained in:
44
src/utils/fvec/fvec.hpp
Normal file
44
src/utils/fvec/fvec.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "utils/using.hpp"
|
||||
|
||||
namespace hr
|
||||
{
|
||||
class fvec_t
|
||||
{
|
||||
public:
|
||||
fvec_t() = default;
|
||||
fvec_t(std::size_t size, base_t v);
|
||||
fvec_t(const fvec_t&) = default;
|
||||
fvec_t& operator=(const fvec_t&) = default;
|
||||
fvec_t(fvec_t&&) noexcept = default;
|
||||
fvec_t& operator=(fvec_t&&) noexcept = default;
|
||||
~fvec_t() = default;
|
||||
|
||||
public:
|
||||
// FOR READING
|
||||
const base_t& operator[](std::size_t index) const { return m_data[index]; }
|
||||
const base_t* data() const noexcept { return m_data.data(); }
|
||||
auto begin() const noexcept { return m_data.begin(); }
|
||||
auto end() const noexcept { return m_data.end(); }
|
||||
|
||||
public:
|
||||
// FOR CHANGING
|
||||
base_t* data() noexcept { return m_data.data(); }
|
||||
std::vector<base_t>& src() noexcept { return m_data; }
|
||||
base_t& operator[](std::size_t index) { return m_data[index]; }
|
||||
auto begin() noexcept { return m_data.begin(); }
|
||||
auto end() noexcept { return m_data.end(); }
|
||||
|
||||
public:
|
||||
std::size_t size() const;
|
||||
bool empty() const;
|
||||
void push_back(const base_t& v);
|
||||
void resize(std::size_t new_size, const base_t el);
|
||||
void shift();
|
||||
|
||||
private:
|
||||
std::vector<base_t> m_data;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user