خرید بک لینک

Vote count: 0

How can I cast vector<int> to const vector<const int>?

I've tried static_cast<const vector<const int>>(array) and using the value without a cast. Neither compiled.

If you're wondering what I'm using this for, I have a function that has a cache stored using a map, and since map keys must be read-only, I need to cast the input vector into a const vector in order to access the cache. (or, at least it doesn't compile and my IDE gives my parameter type mismatch)

asked 26 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 19 تير 1395 ساعت: 5:30

صفحه بندی