I am using gcc 2.95.3. I am missing a constructor for std::vector. In
the stl documentation vector< type>::vector(int) ist mentioned but I get
error messages that there is no candidate. Only vector( const vector
<type>&) and vector() are listed in the compiler output.
Do I have to upgrade or what is wrong??
Joachim
Could you provide some code that shows the error? The following code
does compile without errors on gcc 2.95.3 and gcc3.2 here:
#include <vector>
class c{};
int main()
{
std::vector<c>(3);
}
grmpfff. This is working too! I thought I understood C++ but I am not
shure anymore!!
OK, it is a problem of inheritance,
My construct is
#include <vector>
class a {};
template< class M>
class b : public std::vector< M> {};
b<a> c(3);
the message of g++ is
no matching function for call to `c<a>::c (int)'
candidates are: c<a>::c(const c<a>&)
c<a>::c()
Why are the empty and the copy contructor known and the other not??
Joachim
Because constructors are not inherited. Your derived class will only
have those constructors that you provide yourself, and if you don't
provide any, the compiler generates a default constructor and a copy
constructor for you.