#include <iostream>

using namespace std;

class Vektor {
  public:
    using size_type = unsigned int;

  private:
    double* ap;
    size_type len;

  public:
    Vektor(size_type n = 0, double x = 0) : len(n) {
      ap = new double[n];
      for (size_type i = 0; i < n; i++) ap[i] = x;
    }
    ~Vektor() { delete[] ap; }

    double& operator[](size_type i) {
      return ap[i];
    }
    size_type size() const {
      return len;
    }
};

int main() {
  Vektor v{4};
  for (Vektor::size_type i = 0; i < v.size(); i++)
    v[i] = i;

  cout << "v: ";
  for (Vektor::size_type i = 0; i < v.size(); i++)
    cout << v[i] << " ";
  cout << endl;

  return 0;
}
