C++ templates weird behaviour: "not matching function" outside main -


i working templates not familiar weird happening. have templated class inherits other templated classes.

the problem when create instance of class in main method works expected. however, when create same instance inside function throws compilation error: "not matching function" pointing constructor of templated class.

the question why work in main method not inside function same piece of code (there no problem inclusion)

the code huge ll try illustrate example

int main() { mytemplatedclassparent<parameters> example(arguments);  mytemplatedclasschild<parameters> example_1(arguments); } 

works fine. however

int main() { mymethod(); } 

with

mymethod() { mytemplatedclassparent<parameters> example(arguments); mytemplatedclasschild<parameters> example_1(arguments); } 

does not. in second case not recognize match between call , constructor of class , suggests candidate constructor of class want use. point same thing works in main method difference in second case declared inside method.

edit:

ok, somehow problem on parameters of templates default ones originally. know nothing on templates, appears there inconsistencies between parameters of 2 instances arising when method called. not know how , why, specified explicitly parameters of templates compiled , worked fine. again sorry not giving information knowledge on templates limited.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -