#ifndef ROW_H
#define ROW_H

#include <iostream>
#include <cstdint>
#include <cstdlib>

template<typename T>
class row {
private:
    T* p;
    uint32_t n;
    bool owns;

public:
    // Constructors & Destructor
    row(); // Default constructor
    row(T* data, uint32_t size, bool copy_data = true);
    row(const row& other);            // Copy constructor
    row(row&& other) noexcept;       // Move constructor
    ~row();

    // Assignment Operators
    row& operator=(const row& other); // Copy assignment
    row& operator=(row&& other) noexcept; // Move assignment

    // Member Functions
    uint32_t size() const;
    T* data();
    const T* data() const;

    // Element Access
    T& operator[](uint32_t index);
    const T& operator[](uint32_t index) const;
    T& at(uint32_t index);
    const T& at(uint32_t index) const;

    // Stream Operators (friend declarations)
    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