Hi Henk,
You concern regarding the usage Visual Studio 2013 app is best being handled in MSDN forums. Here's the link.
Do let us know if you have any other concerns.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This question must have been asked more than once, but I cannot find a working answer anywhere. The goal is to create a class based on the std::vector class and use the range checking in addition. The code, literally taken from a book by Stroustrup (sp?), is below. I can't get it to work, it won't compile on VS2013. It is the statetement 'using vector<T>::vector;' that is the culprit.
Error 1 error C2886: 'vector<T,std::allocator<_Ty>>' : symbol cannot be used in a member using-declaration c:\insightmontrex\ver12.0\src\anytest.cpp 8 1 AnyTest
Error 3 error C2664: 'Vector<int>::Vector(const Vector<int> &)' : cannot convert argument 1 from 'int' to 'const Vector<int> &' c:\insightmontrex\ver12.0\src\anytest.cpp 17 1 AnyTest
Does anyone know how to handle this properly?
#include<vector>
usingstd::vector;
template<typenameT>
classVector : publicstd::vector<T>
{
public:
usingvector<T>::vector; // inherit constructors***
T& operator { returnvector<T>::at(i); } // range-checked
constT& operator const{ returnvector<T>::at(i); } // for const objects;
};
intmain()
{
Vector <int> V(5);
}
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Hi Henk,
You concern regarding the usage Visual Studio 2013 app is best being handled in MSDN forums. Here's the link.
Do let us know if you have any other concerns.