How to convert vector<unique_ptr<T>>
to vector<unique_ptr<const T>>
?
Any downside of using reinterpret_cast
? What's recommended way to do so in C++11 and forward?
vector<unique_ptr<const T>> Get() {
vector<unique_ptr<T>> some;
...
// Any better way to do this?
return *(reinterpret_cast<vector<unique_ptr<const T>>*>(&some));
}
Aucun commentaire:
Enregistrer un commentaire