- 49 名前:デフォルトの名無しさん mailto:sage [2009/07/03(金) 13:29:28 ]
- 次のようなプログラムをgcc(3.3.5, 4.4.0)でコンパイルするとハネられます。
PGIやwindows SDKのコンパイラなら問題なく通るのだけど、なにか間違ってる? T::size_type is parsed as a non-typeとか言ってくるし。 でも、 void func(const T&) [with T=std::vector<double, std::allocator;double> >]と、Tがvector型だとわかってインスタンス化してるんですがねぇ。 当然、vector<double>::size_typeは存在するのでテンプレートとして書かなければgccでも通ります。 バグ? #include <iostream> #include <vector> using namespace std; template <class T> inline void func(const T& a) { T::size_type length = a.size(); cout << length << endl; } int main(int argc, int argv) { vector<double> a(5); func(a); return 0; }
|

|