Sound like a bug, I get the following errors for initialization line: ////////////////////////////////////////////////////////// main.cpp:10:243: error: conflicting declaration ‘const std::vector<std::pair<int, std::basic_string<char> > > EventHandlerAbstract<test, int, int, int, int, int>::eventList’ In file included from main.cpp:3:0: Common/eventhandlerabstract.h:114:51: 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:10:243: error: template arguments to ‘EventHandlerAbstract<test, int, int, int, int, int>::eventList’ do not match original template ‘EventHandlerAbstract<Class, ReturnType, Parameter1, Parameter2, Parameter3, Parameter4>::eventList’ /////////////////////////////////////////////////////////// and my initialization line is : //////////////////////////////////////////////////////////////// template < class Class, typename ReturnType,typename Parameter1 , typename Parameter2 , typename Parameter3 , typename Parameter4 > std::vector < std::pair<int, string> > const EventHandlerAbstract< test,int,int,int,int,int >::eventList = &EventHandlerAbstract<test,int,int,int,int,int>::eventStaticMemberVectorInit(); /////////////////////////////////////////////////////////////////// I read the following page and now, i think a bug: http://preciseinfo.org/Convert/Articles_CPP/Template_Experts/C ++-VC-ATL-STL-Template-Experts-06400276.html --mohsen On Tue, 2012-07-10 at 05:23 -0700, Ian Lance Taylor wrote: > 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
Attachment:
signature.asc
Description: This is a digitally signed message part