Visual C ++ 7.1内部编译器错误 [英] Visual C++ 7.1 INTERNAL COMPILER ERROR
问题描述
//像往常一样,错误消息将一个人指向报告错误。
//
//和往常一样,没有办法这样做没有支付
//权限...
//
//或者使用三到四个小时来查找_current_报告页面。 ..
#include< vector>
#include< iostream>
template< typename T,size_t N>
struct ArrayHolder
{
T elem [N];
};
模板< typename T>
class VectorImpl
{
private:
std :: vector< T> elem;
public:
template< size_t N>
VectorImpl(T const(& values)[N]):elem(值,值+ N){}
T& operator [](size_t i){return elem.at(i); }
T const& operator [](size_t i)const {return elem.at(i); }
};
模板< typename T>
class Vector:public VectorImpl< T>
{
public:
template< size_t N>
VectorImpl(T const(& values)[N]):VectorImpl(values){}
};
int main()
{
typedef ArrayHolder< double,6> DoubleArray6;
static DoubleArray6 const x = {10,20,30,40,50,60};
static DoubleArray6 const xArray [] = {x};
Vector< DoubleArray6> v(xArray);
for(size_t i = 0; i< 6; ++ i)
{
std :: cout << v [0] .elem [i]<< std :: endl;
}
}
-
A:因为它混乱了人们通常阅读文字的顺序。
问:为什么顶级发布这么糟糕的事情?
A:热门发布。
问:usenet和电子邮件中最烦人的是什么?
// As usual the error message directs one to the report the bug.
//
// And as usual there is absolutely no way to do so without paying for
// the privilege...
//
// Or using three or four hours to find the _current_ reporting page...
#include <vector>
#include <iostream>
template< typename T, size_t N >
struct ArrayHolder
{
T elem[N];
};
template< typename T >
class VectorImpl
{
private:
std::vector<T> elem;
public:
template< size_t N >
VectorImpl( T const (&values)[N] ): elem( values, values+N ) {}
T& operator[]( size_t i ){ return elem.at( i ); }
T const& operator[]( size_t i ) const { return elem.at( i ); }
};
template< typename T >
class Vector: public VectorImpl< T >
{
public:
template< size_t N >
VectorImpl( T const (&values)[N] ): VectorImpl( values ) {}
};
int main()
{
typedef ArrayHolder<double, 6> DoubleArray6;
static DoubleArray6 const x = { 10, 20, 30, 40, 50, 60 };
static DoubleArray6 const xArray[] = { x };
Vector<DoubleArray6> v( xArray );
for( size_t i = 0; i < 6; ++i )
{
std::cout << v[0].elem[i] << std::endl;
}
}
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
推荐答案
Alf P. Steinbach写道:
Alf P. Steinbach wrote:
#include< vector>
#include< iostream>
模板< typename T,size_t N>
struct ArrayHolder
{elem [N];
};
模板< typename T>
类VectorImpl
{
私人:
std :: vector< T> elem;
公众:
模板< size_t N>
VectorImpl(T const(& values)[N]):elem(values,values + N){}
T& operator [](size_t i){return elem.at(i); T const& operator [](size_t i)const {return elem.at(i); }
};
模板< typename T>
类Vector:public VectorImpl< T>
{
公开:
模板< size_t N>
VectorImpl(T const(& values)[N]):VectorImpl(values){}
它导致内部编译器错误的事实可能有点奇怪,但
这是你的代码有问题。您定义一个名称为
与其所在类不匹配的构造函数,此外,您尝试使用基础
类构造函数而不指定模板参数。
该行应该是:
向量(T const(& values)[N]):VectorImpl< T>(值) {}
代码编译好了。
};
int main()
{
typedef ArrayHolder< double,6> DoubleArray6;
静态DoubleArray6 const x = {10,20,30,40,50,60
}; static DoubleArray6 const xArray [] = {x};
Vector< DoubleArray6> v(xArray);
for(size_t i = 0; i< 6; ++ i)
{
std :: cout<< v [0] .elem [i]<< std :: endl;
}
}
#include <vector>
#include <iostream>
template< typename T, size_t N >
struct ArrayHolder
{
T elem[N];
};
template< typename T >
class VectorImpl
{
private:
std::vector<T> elem;
public:
template< size_t N >
VectorImpl( T const (&values)[N] ): elem( values, values+N ) {}
T& operator[]( size_t i ){ return elem.at( i ); }
T const& operator[]( size_t i ) const { return elem.at( i ); }
};
template< typename T >
class Vector: public VectorImpl< T >
{
public:
template< size_t N >
VectorImpl( T const (&values)[N] ): VectorImpl( values ) {}
The fact that it causes an internal compiler error may be a bit strange, but
it is your code that''s at fault. You define a constructor with a name that
does not match the class it''s in, and furthermore you try to use the base
class constructor without specifying template arguments.
The line should be:
Vector(T const (&values)[N] ) : VectorImpl<T>(values) {}
The code compiles fine then.
};
int main()
{
typedef ArrayHolder<double, 6> DoubleArray6;
static DoubleArray6 const x = { 10, 20, 30, 40, 50, 60
}; static DoubleArray6 const xArray[] = { x };
Vector<DoubleArray6> v( xArray );
for( size_t i = 0; i < 6; ++i )
{
std::cout << v[0].elem[i] << std::endl;
}
}
-
不可饶恕
--
Unforgiven
Alf P. Steinbach在新闻中写道:40 ***************** @ news.individual.net在
comp.lang.c ++:
主题:Visual C ++ 7.1内部编译器错误
Alf P. Steinbach wrote in news:40*****************@news.individual.net in
comp.lang.c++:
Subject: Visual C++ 7.1 INTERNAL COMPILER ERROR
//像往常一样,错误消息指示一个报告错误。
//
//和往常一样,如果没有支付
//权限,绝对没有办法做到这一点......
//
//或使用三到四个小时来查找_current_报告页面...
尝试发布到:
news://microsoft.public.dotnet.languages.vc
希望MS的某个人可以从那里拿起它。
[snip]
模板< typename T>
类Vector:public VectorImpl< T>
{
公开:
模板< size_t N>
VectorImpl(T const(& values)[N]):VectorImpl(values){}
你可能已经知道了但是:
向量(T const(& values)[N]):VectorImpl< T>(值){}
};
// As usual the error message directs one to the report the bug.
//
// And as usual there is absolutely no way to do so without paying for
// the privilege...
//
// Or using three or four hours to find the _current_ reporting page...
Try posting to:
news://microsoft.public.dotnet.languages.vc
Hopefully someone from MS can pick it up from there.
[snip]
template< typename T >
class Vector: public VectorImpl< T >
{
public:
template< size_t N >
VectorImpl( T const (&values)[N] ): VectorImpl( values ) {}
You probably know this already but:
Vector( T const (&values)[N] ): VectorImpl< T >( values ) {}
};
[snip]
I有我的编辑器设置所以我可以发送我的代码(目前)
5(*)不同的编译器,真的有助于ICE'。
* )也许4,这几天我很少使用borland 5.4来超过
a便宜的笑。 (刚刚检查了我的固定代码)。
Rob。
-
http://www.victim-prime.dsl.pipex.com/
*" Unforgiven" < JA ******* @ hotmail.com> schriebt:
* "Unforgiven" <ja*******@hotmail.com> schriebt:
它导致内部编译器错误的事实可能有点奇怪,但是你的代码是错误的。
The fact that it causes an internal compiler error may be a bit strange, but
it is your code that''s at fault.
<茶匙模式>
程序崩溃时用户的输入是_never_错误。
一个程序,比如编译器,无论输入什么输入都不会崩溃。
对于一个更为关键的编译器比其他程序。
< /茶匙模式>
你明白这个吗?
什么是你的真名?
-
答:因为它弄乱了人们通常阅读文字的顺序。
Q :为什么顶级发布这么糟糕的事情?
A:热门发布。
问:usenet和电子邮件中最烦人的是什么?
<teaspoon mode>
The user''s input is _never_ at fault for a program crash.
A program, such as a compiler, shall never crash no matter what input
it is given.
For a compiler that''s even more critical than for other programs.
</teaspoon mode>
Did you understand this?
What is your real name?
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
这篇关于Visual C ++ 7.1内部编译器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!