Ah, tak od siebie dodam jeszcze drobną wskazówkę: naucz się czytać błędy kompilacji generowane przy szablonach.
Mini zadanie, przygotowane specjalnie dla Ciebie:
Na podstawie poniższego błędu kompilacji wydedukuj faktyczny problem w kodzie
In file included from ../TreeStructInfo_Test/src/Parser/general.cpp:3:
In file included from ../TreeStructInfo_Test/include/Parser/Scenarios/Configuration.hpp:14:
../TreeStructInfo_Test/include/Parser/Parser.hpp:32:41: error: no matching function for call to 'getline'
while(collector.isCollecting && getline(istream, line))
^~~~~~~
../TreeStructInfo_Test/src/Parser/general.cpp:58:16: note: in instantiation of function template specialization 'TreeStructInfo::Parser<TreeStructInfo::StateMachine<TreeStructInfo::InterpretStrategiesResponsibilityChain<TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > >, std::__1::basic_string<char> >, Util::DictionaryTranslator> >::loadTreeFromTextStream<char const[14]>' requested here
parser.loadTreeFromTextStream("notatxtstream");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/istream:1633:1: note: candidate template ignored: could not match 'basic_istream<type-parameter-0-0, type-parameter-0-1>' against 'char const[14]'
getline(basic_istream<_CharT, _Traits>& __is,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/istream:1653:1: note: candidate template ignored: could not match 'basic_istream<type-parameter-0-0, type-parameter-0-1>' against 'char const[14]'
getline(basic_istream<_CharT, _Traits>&& __is,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/istream:1584:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided
getline(basic_istream<_CharT, _Traits>& __is,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/istream:1644:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided
getline(basic_istream<_CharT, _Traits>&& __is,
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/stdio.h:442:9: note: candidate function not viable: requires 3 arguments, but 2 were provided
ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
^
In file included from ../TreeStructInfo_Test/src/Parser/general.cpp:3:
In file included from ../TreeStructInfo_Test/include/Parser/Scenarios/Configuration.hpp:6:
In file included from ../TreeStructInfo/include/DefaultTree.hpp:5:
In file included from ../TreeStructInfo/include/DefaultNode.hpp:5:
In file included from ../TreeStructInfo/include/DefaultAttribute.hpp:7:
../TreeStructInfo/include/Attribute.hpp:42:12: warning: field 'value' will be initialized after base 'commentable_base' (aka 'TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >') [-Wreorder]
): value(value_), commentable_base(comment_), nameable_base(name_){}
^
../TreeStructInfo_Test/include/CollectingTreats/AttributeTreat.hpp:30:17: note: in instantiation of member function 'TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >::Attribute' requested here
attribute_type(
^
../TreeStructInfo_Test/include/CollectingTreats/AttributeTreat.hpp:67:13: note: in instantiation of member function 'TreeStructInfo::CollectingTreats::AttributeTreat<TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > > >::collect' requested here
collect(name, value);
^
../TreeStructInfo_Test/include/InterpretStrategies/Attribute.hpp:13:59: note: in instantiation of function template specialization 'TreeStructInfo::CollectingTreats::AttributeTreat<TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > > >::prepareNext<std::__1::basic_string<char> >' requested here
[&collector, &line]{ collector.attributeTreat.prepareNext(line); }
^
../TreeStructInfo_Test/include/InterpretStrategies/TagsMapped.hpp:22:35: note: in instantiation of function template specialization 'TreeStructInfo::LineHandlingStrategies::attributeStrategy<TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > >, std::__1::basic_string<char> >' requested here
{tag_type::Attribute, attributeStrategy<collector_type, string_type>},
^
In file included from ../TreeStructInfo_Test/src/Parser/general.cpp:3:
In file included from ../TreeStructInfo_Test/include/Parser/Scenarios/Configuration.hpp:20:
../TreeStructInfo_Test/include/Parser/StateMachine.hpp:135:16: warning: enumeration value 'Count' not handled in switch [-Wswitch]
switch(getState()){
^
../TreeStructInfo_Test/include/Parser/StateMachine.hpp:75:34: note: in instantiation of member function 'TreeStructInfo::StateMachine<TreeStructInfo::InterpretStrategiesResponsibilityChain<TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > >, std::__1::basic_string<char> >, Util::DictionaryTranslator>::setState' requested here
}, std::bind(&this_type::setState, std::ref(*this), std::placeholders::_1));
^
../TreeStructInfo_Test/include/Parser/StateMachine.hpp:88:9: note: in instantiation of function template specialization 'TreeStructInfo::StateMachine<TreeStructInfo::InterpretStrategiesResponsibilityChain<TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > >, std::__1::basic_string<char> >, Util::DictionaryTranslator>::wrapStates<std::__1::map<TreeStructInfo::StrategyTag, std::__1::function<bool (TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > > &, const std::__1::basic_string<char> &)>, std::__1::less<TreeStructInfo::StrategyTag>, std::__1::allocator<std::__1::pair<const TreeStructInfo::StrategyTag, std::__1::function<bool (TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > > &, const std::__1::basic_string<char> &)> > > > >' requested here
wrapStates(dict);
^
../TreeStructInfo_Test/include/Parser/StateMachine.hpp:176:9: note: in instantiation of function template specialization 'TreeStructInfo::StateMachine<TreeStructInfo::InterpretStrategiesResponsibilityChain<TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > >, std::__1::basic_string<char> >, Util::DictionaryTranslator>::wrapStrategies<std::__1::map<TreeStructInfo::StrategyTag, std::__1::function<bool (TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > > &, const std::__1::basic_string<char> &)>, std::__1::less<TreeStructInfo::StrategyTag>, std::__1::allocator<std::__1::pair<const TreeStructInfo::StrategyTag, std::__1::function<bool (TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > > &, const std::__1::basic_string<char> &)> > > > >' requested here
wrapStrategies(dict);
^
../TreeStructInfo_Test/include/Parser/Parser.hpp:26:50: note: in instantiation of function template specialization 'TreeStructInfo::StateMachine<TreeStructInfo::InterpretStrategiesResponsibilityChain<TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > >, std::__1::basic_string<char> >, Util::DictionaryTranslator>::StateMachine<std::__1::map<TreeStructInfo::StrategyTag, std::__1::function<bool (TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > > &, const std::__1::basic_string<char> &)>, std::__1::less<TreeStructInfo::StrategyTag>, std::__1::allocator<std::__1::pair<const TreeStructInfo::StrategyTag, std::__1::function<bool (TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > > &, const std::__1::basic_string<char> &)> > > > >' requested here
Parser(const Dict &dict): collector(memory), machine(dict, collector){}
^
../TreeStructInfo_Test/src/Parser/general.cpp:8:17: note: in instantiation of function template specialization 'TreeStructInfo::Parser<TreeStructInfo::StateMachine<TreeStructInfo::InterpretStrategiesResponsibilityChain<TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > >, std::__1::basic_string<char> >, Util::DictionaryTranslator> >::Parser<std::__1::map<TreeStructInfo::StrategyTag, std::__1::function<bool (TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > > &, const std::__1::basic_string<char> &)>, std::__1::less<TreeStructInfo::StrategyTag>, std::__1::allocator<std::__1::pair<const TreeStructInfo::StrategyTag, std::__1::function<bool (TreeStructInfo::Collector<TreeStructInfo::CollectedMemory<stack_template_type, deque_template_type, TreeStructInfo::Template::Tree<TreeStructInfo::Template::Node<nodes_map_type, attributes_map_type, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > >, TreeStructInfo::Ingredients::Versionable<std::__1::basic_string<char> > >, TreeStructInfo::Template::Attribute<std::__1::basic_string<char>, TreeStructInfo::Ingredients::Commentable<std::__1::basic_string<char> >, TreeStructInfo::Ingredients::Nameable<std::__1::basic_string<char> > > > > &, const std::__1::basic_string<char> &)> > > > >' requested here
parser_type parser(dict);
Z góry mówię, że w zabawie nie uczestniczą obeznane osoby, których wprawne oko dość szybko (jeśli nie natychmiastowo) wyłapie podłożoną owcę :)