I want a class derived from std::vector
for my operator []
template<class T>
class MyVector : public std::vector<T>
{
public:
// ?...
const T &operator[](size_t index) const
{
//...
}
T &operator[](size_t index)
{
//...
}
};
int main()
{
MyVector<int> myVec = { 1, 2, 3 };
//...
}
How can I do this deriving all std::vector
constructors and assigning operators for C++11?
Aucun commentaire:
Enregistrer un commentaire