#include <vector>
int main()
{
typedef const std::vector<const int> set_t;
set_t Low = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
return 0;
}
When compiling the above code I got trillion of errors from STL headers.
What I want to do here is to initialize a vector and ensure that values can not be changed at some point later and also to make sure that no new values can be added.
This vector should be created once with initial values and not changed in any way.
What's wrong here?
This is also a const vector, and it will let your code compile.
typedef const std::vector<int> set_t;
Making the std::vector alone const will expose only the non-modifying interface. Your ints will not change.
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