模板矢量,不完整类型错误
我正在迁移一些std :: vectors而不是使用模板,但我在结构声明中得到了
不完整的类型错误。
#include< vector>
template< typename T>
class Vec:public std :: vector< T {
public:
Vec():Vec< T>(){}
Vec(int s):std :: vector< ; T>(s){}
T& operator [](int i){return at(i); }
const T& operator [](int i)const {return at(i); }
};
typedef Vec< doublevecdbl;
typedef Vec< vecdblmatdbl;
#include" matvec .h"
//就在上面
typedef vecdbl memvec;
struct felt
{
...
memvec m; //< - 不完整类型错误
Hi,
I am migrating some std::vectors to use a template instead, but I get
an incomplete type error in a struct declaration.
#include <vector>
template < typename T >
class Vec : public std::vector< T {
public:
Vec():Vec<T>() { }
Vec( int s ) : std::vector<T>(s) { }
T& operator[](int i) { return at(i); }
const T& operator[](int i ) const { return at(i); }
};
typedef Vec<doublevecdbl;
typedef Vec<vecdblmatdbl;
#include "matvec.h"
// that is it above
typedef vecdbl memvec;
struct felt
{
...
memvec m; // <- incomplete type error
文章< 11 ************ **********@c28g2000cwb.googlegroups .com> ;,
< im ***** @ hotmail.co.ukwrote:
In article <11**********************@c28g2000cwb.googlegroups .com>,
<im*****@hotmail.co.ukwrote:
>
我正在迁移一些std :: vectors而不是使用模板,但我在结构声明中得到了一个不完整的类型错误。
#include< vector>
模板< typename T>
类Vec:public std :: vector< T {
public:
Vec():Vec< T>(){}
Vec(int s):std :: vector< T>( s){}
T& operator [](int i){return at(i); }
const T& operator [](int i)const {return at(i); }
};
typedef Vec< doublevecdbl;
typedef Vec< vecdblmatdbl;
#include" matvec.h"
/ /就是它上面
typedef vecdbl memvec;
结构感觉
{
..
memvec m; //< - 不完整类型错误
>Hi,
I am migrating some std::vectors to use a template instead, but I get
an incomplete type error in a struct declaration.
#include <vector>
template < typename T >
class Vec : public std::vector< T {
public:
Vec():Vec<T>() { }
Vec( int s ) : std::vector<T>(s) { }
T& operator[](int i) { return at(i); }
const T& operator[](int i ) const { return at(i); }
};
typedef Vec<doublevecdbl;
typedef Vec<vecdblmatdbl;
#include "matvec.h"
// that is it above
typedef vecdbl memvec;
struct felt
{
..
memvec m; // <- incomplete type error
我不明白Vec():Vec< T>(),可能你是编译器
因为这个问题,
最终没有成为Vec< Tincomplete课程
。
-
Greg Comeau / 20年的Comeauity! Intel Mac Port现在为alpha!
Comeau C / C ++ ONLINE == http://www.comeaucomputing.com/tryitout
世界级编译器:令人惊叹的C ++,惊人的C99,很棒的C90。
Comeau C / C ++与Dinkumware你的图书馆......你试过吗?
I don''t understand Vec():Vec<T>() and probably you''re compiler
doesn''t either eventually makeing Vec<Tincomplete classes
because of that problem.
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in alpha!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware''s Libraries... Have you tried it?
在文章< ef ********** @ panix1.panix.com>中,
Greg Comeau< co **** @ comeaucomputing.comwrote:
In article <ef**********@panix1.panix.com>,
Greg Comeau <co****@comeaucomputing.comwrote:
>文章< 11 ***** *****************@c28g2000cwb.googlegroups .com> ;,
< im ***** @ hotmail.co.ukwrote:
>In article <11**********************@c28g2000cwb.googlegroups .com>,
<im*****@hotmail.co.ukwrote:
>>
我正在迁移一些std :: vectors而不是使用模板,但是我得到了一个不完整的类型错误结构声明。
#include< vector>
模板< typename T>
类Vec:public std :: vector< T {
public:
Vec():Vec< T>(){}
Vec(int s):std :: vector< T>(s){}
T&安培; operator [](int i){return at(i); }
const T& operator [](int i)const {return at(i); }
};
typedef Vec< doublevecdbl;
typedef Vec< vecdblmatdbl;
#include" matvec.h"
/ /就是它上面
typedef vecdbl memvec;
结构感觉
{
..
memvec m; //< - 不完整类型错误
>>Hi,
I am migrating some std::vectors to use a template instead, but I get
an incomplete type error in a struct declaration.
#include <vector>
template < typename T >
class Vec : public std::vector< T {
public:
Vec():Vec<T>() { }
Vec( int s ) : std::vector<T>(s) { }
T& operator[](int i) { return at(i); }
const T& operator[](int i ) const { return at(i); }
};
typedef Vec<doublevecdbl;
typedef Vec<vecdblmatdbl;
#include "matvec.h"
// that is it above
typedef vecdbl memvec;
struct felt
{
..
memvec m; // <- incomplete type error
我不明白Vec():Vec< T>(),可能你是编译器
不会''由于这个问题,最终要么成为Vec< Tincomplete classes
。
I don''t understand Vec():Vec<T>() and probably you''re compiler
doesn''t either eventually makeing Vec<Tincomplete classes
because of that problem.
另外在另一个方面:std :: vector未被写为
派生自。
-
Greg Comeau / 20年的Comeauity! Intel Mac Port现在为alpha!
Comeau C / C ++ ONLINE == http://www.comeaucomputing.com/tryitout
世界级编译器:令人惊叹的C ++,惊人的C99,很棒的C90。
Comeau C / C ++与Dinkumware你的图书馆......你试过吗?
Also on a different aspect: std::vector was not written to be
derived from.
--
Greg Comeau / 20 years of Comeauity! Intel Mac Port now in alpha!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware''s Libraries... Have you tried it?
im * **** @ hotmail.co.uk 写道:
im*****@hotmail.co.uk wrote:
#include< vector>
模板< typename T>
class Vec:public std :: vector< T {
public:
Vec():Vec< T>(){}
#include <vector>
template < typename T >
class Vec : public std::vector< T {
public:
Vec():Vec<T>() { }
Vec( ):std :: vector< T>(){}
Vec() : std::vector<T>() {}
Vec(int s):std :: vector< T>(s){}
T& operator [](int i){return at(i); }
Vec( int s ) : std::vector<T>(s) { }
T& operator[](int i) { return at(i); }
& operator [](int i){return this-> at(i); }
& operator[](int i) { return this->at(i); }
const T& operator [](int i)const {return at(i); }
const T& operator[](int i ) const { return at(i); }
const T& operator [](int i)const {return this-> at(i); }
const T& operator[](int i ) const { return this->at(i); }
};
typedef Vec< doublevecdbl;
typedef Vec< vecdblmatdbl;
#include" matvec.h"
//就在上面
typedef vecdbl memvec;
结构感觉
{
..
memvec m; * //< - 不完整类型错误
};
typedef Vec<doublevecdbl;
typedef Vec<vecdblmatdbl;
#include "matvec.h"
// that is it above
typedef vecdbl memvec;
struct felt
{
..
memvec m; *// <- incomplete type error
最佳
Kai-Uwe Bux
Best
Kai-Uwe Bux