#ifndef ROW_HPP
#define ROW_HPP
#include "sorting_algorithms.hpp"
#include <iostream>
#include <cstdint>
#include <utility>

using namespace std;
template <typename T>
class Row;


template <typename T>
ostream& operator <<(ostream& os, const Row<T>& r);

template <typename T>
istream& operator>>(istream& is, Row<T>& r);

template <typename T>
class Row {
	private:
		T* p;
		uint32_t n;


	public:
		//constructor
		Row(uint32_t size=0);

		//constructor for the second part
		Row(T* arr, uint32_t size);

		//destuctor
		~Row();

		//copy constractor
		Row(const Row &other);

		//assignment operator(deep copy)
		Row& operator=(const Row& other);

		//operator[]
		T& operator[](uint32_t idx);

		const T& operator[](uint32_t idx) const;

		//operator at
		T& at(uint32_t idx);

		const T& at(uint32_t idx) const;

		//ostream operator
		friend ostream& operator<<(ostream& os,const Row<T>& r){
			for (uint32_t i=0; i< r.n; i++){
				os << r.p[i];;
				if (i<r.n-1){
					os <<"  ";
					}
				}
			return os;
			}


		//istream operator
		friend istream& operator>>(istream& is, Row<T>& r){
			for (uint32_t i=0; i<r.n; i++){
				is >> r.p[i];
				}
			return is;
			}


		//functions
		uint32_t size() const;
};


#endif
