Advertisement
Guest User

Untitled

a guest
Aug 9th, 2022
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <vector>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. class _vector {
  6.     vector<int> x = {1, 2, 3};
  7. public:
  8.     vector<int>::iterator begin(){
  9.         return x.begin();
  10.     }
  11.  
  12.     vector<int>::iterator end(){
  13.         return x.end();
  14.     }
  15.  
  16.     vector<int>::const_iterator cbegin() const {
  17.         return x.cbegin();
  18.     }
  19.  
  20.     vector<int>::iterator cend() const {
  21.         return x.cend();
  22.     }
  23.  
  24.     void test() const {
  25.         for(const int& i : x)
  26.             cout << i << " ";
  27.     }
  28.  
  29. };
  30.  
  31. int main()
  32. {
  33.     _vector a;
  34.     a.test();
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement