Re: static member initilization

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

 



On Tue, Jul 10, 2012 at 5:07 AM, Mohsen Pahlevanzadeh
<mohsen@xxxxxxxxxxxxxxxxx> wrote:
>
> but when i initialize my vector such as following line:
> ////////////////////////////
> template <  >  std::pair<int, string> EventHandlerAbstract<
> test,int,int,int,int,int >::eventList =
> &EventHandlerAbstract<test,int,int,int,int,int>::eventStaticMemberVectorInit();
> ///////////////////////////////////////////////////////////
> i get the following errors:
> ////////////////////////////////////////////////////////
> error: ‘EventHandlerAbstract<test, int, int, int, int, int>::eventList’
> has a previous declaration as ‘std::vector<std::pair<int,
> std::basic_string<char> > >* EventHandlerAbstract<test, int, int, int,
> int, int>::eventList’
> main.cpp:9:178: error: ‘EventHandlerAbstract<test, int, int, int, int,
> int>::eventList’ cannot be initialized by a non-constant expression when
> being declared
> ////////////////////////////////////////////////////////

1) This does not look like a question about how to use GCC.  It looks
like a question about how to use C++.

2) Please try hard to send a complete self-contained example, rather
than a collection of little bits of code.  Often the attempt to create
an example will answer the question for you.

3) The declaration of eventList within the class uses
std::vector<std::pair<>>, the declaration in the file uses just
std::pair, without std::vector.  That is probably the root cause of
your problem.

Ian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux