help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vector<> error


From: Thomas Maeder
Subject: Re: vector<> error
Date: Mon, 20 Apr 2009 22:23:08 +0200
User-agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux)

mamboknave@gmail.com writes:

> With g++ v.4.3.2 instead I get the reported error.

g++ is correct.


> I would thankfully appreciate any help.
>
> volcalc.cpp:26: error: template argument for 'template<class _Alloc>
> class std::allocator' uses local type 'main(int, char**)::series'
> volcalc.cpp:26: error:   trying to instantiate 'template<class _Alloc>
> class std::allocator'
> volcalc.cpp:26: error: template argument 2 is invalid
> volcalc.cpp:66: error: request for member 'resize' in 'alldata', which
> is of non-class type 'int'
>
> int main(int argc, char *argv[])
> {
>         struct series {
>                 ....
>         };

series is a local name and therefore has no linkage.


>         int nr;
> ....
>         vector<series> alldata;   // line 26

Currently, template parameters have to have external linkage. This may
change in future versions of the ISO C++ Standard.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]