47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
#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 reserve(std::size_t size);
|
|
void shift();
|
|
void clear();
|
|
|
|
private:
|
|
std::vector<base_t> m_data;
|
|
};
|
|
}
|
|
|