I thought the only way to declare a const<vector>
is:
const std::vector<T> v;
const
applies to the thing to its left, except for when there is nothing on the left then it applies to the thing to its right.
So, const int a=1;
and int const a=1;
are equal.
const int *b
and int const *b
are equal (pointer to a constant int
), but different to int * const b
, which is a constant pointer to a non-constant int
.
This applies to all data types, I choose int
because it is easier to type than std::vector<T>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With