How to initialize a vector in c++?

Example:


  #include 
  int main() {
      std::vector myVector = {1, 2, 3, 4, 5};
  }
  

Solution:


  #include 
  int main() {
      std::vector myVector{1, 2, 3, 4, 5}; 
  }
  

Beginner's Guide to C++