Reputation: 1
const int NUM_DIGITS = 7;
int pin1[NUM_DIGITS] = {2, 4, 1, 8, 7, 9, 0};
int pin2[NUM_DIGITS] = {2, 4, 6, 8, 7, 9, 0};
int pin3[NUM_DIGITS] = {1, 2, 3, 4, 5, 6, 7};
Upvotes: 0
Views: 41
Reputation: 862
std::vector defines a constructor that takes in two InputIterators and a default allocator with
template <class InputIterator>
vector (InputIterator first, InputIterator last,
const allocator_type& alloc = allocator_type());
So you can just create a vector from an array like so,
std::vector<int> vec(pin1, pin1 + NUM_DIGITS);
Upvotes: 1