Ilya_konstantinov

Untitled

Apr 18th, 2026
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1.  
  2. using ssize_t = signed long long;
  3. using size_t = unsigned long long;
  4. using int32_t = int;
  5.  
  6. class MyVector {
  7. private:
  8.    size_t size_ = 0;
  9.    size_t capacity_ = 0;
  10.    int32_t* arr_ = nullptr;
  11.  
  12. public:
  13.    MyVector();
  14.    
  15.    MyVector(size_t n);
  16.    
  17.    MyVector(size_t n, int32_t value);
  18.    
  19.    ~MyVector();
  20.    
  21.    MyVector(const MyVector& other);
  22.    
  23.    MyVector& operator=(const MyVector& other);
  24.    
  25.    size_t Size() const;
  26.    
  27.    size_t Capacity() const;
  28.    
  29.    void Read(size_t n);
  30.    
  31.    void PrintSize() const;
  32.    
  33.    void Print() const;
  34.    void PushBack(int32_t x);
  35.    
  36.    int32_t PopBack();
  37.    
  38.    void Clear();
  39.    
  40.    void Insert(int32_t x, size_t k);
  41.    
  42.    void Erase(size_t k);
  43.    
  44.    void Resize(size_t new_size);
  45.  
  46.    void Reserve(size_t new_cap);
  47.    
  48.    int32_t& operator[](ssize_t index);
  49.    
  50.    const int32_t& operator[](size_t index) const;
  51.  
  52.    MyVector& operator^=(const MyVector &other);
  53.  
  54.    int32_t Max() const;
  55.  
  56.    int32_t Min() const;
  57.  
  58.    long long Sum() const;
  59.  
  60.    long double Mean() const;
  61. };
  62.  
Advertisement
Add Comment
Please, Sign In to add comment