c++ - Error while inheriting std::vector -
i trying define inherited class std::vector class. below code
template<class t> class vector:vector<t> { public: using vector<t>::vector; }; int main(int argc, char *argv[]) { vector<int> v; return 0; }
and getting error this:
"error: 'std::vector<t, std::allocator<_chart> >::vector' names constructor"
so know why program failing , procedures overloaded in inherited class parent std::vector class.
thanks in advance.
i tried:
#include <vector> template<class t> class vector: std::vector<t> { public: using std::vector<t>::vector; }; int main() { vector<int> v; return 0; }
and works fine on gcc 4.8.
when passing flag -std=c++11
.
it sounds compiler cannot figure out trying accomplish using
directive. since inheriting constructors c++11 feature, suggest make sure running compiler in c++11 mode.
Comments
Post a Comment