#ifndef ROW_HPP
#define ROW_HPP

#include <iostream>
#include <cstdint>
#include <cstdlib>

template<typename T>
class row
{
private:
    T* p;
    uint32_t n;
    bool owns;

public:
    row();
    row(T* data, uint32_t size, bool copy_data = true);
    row(const row& other);
    row(row&& other) noexcept;
    row& operator=(const row& other);
    row& operator=(row&& other) noexcept;
    ~row();

    uint32_t size() const;

    T& operator[](uint32_t index);
    const T& operator[](uint32_t index) const;

    T& at(uint32_t index);
    const T& at(uint32_t index) const;

    T* data();
    const T* data() const;

    template<typename U>
    friend std::ostream& operator<<(std::ostream& os, const row<U>& obj);

    template<typename U>
    friend std::istream& operator>>(std::istream& is, row<U>& obj);
};

#endif