petergottschling / discovering_modern_cpp

Source codes of Discovering Modern C++
200 stars 83 forks source link

my_info.hpp is missing #4

Open jdmairs opened 7 years ago

jdmairs commented 7 years ago

c++11/template_type_deduction.cpp includes ../myinfo.hpp which is missing. P109 in the book.

jdmairs commented 7 years ago

Well I wrote my own my_info but the code for template_type_deduction does not compile in numerous places. Very frustrating because type deduction rules continue to elude me.

In instantiation of ‘void f3(TPara&) [with TPara = int]’: /home/jmairs/Documents/discovering_modern_cpp/c++11/template_type_deduction.cpp:95:9: required from here /home/jmairs/Documents/discovering_modern_cpp/c++11/template_type_deduction.cpp:25:15: error: value-initialization of reference type ‘int&’ << " == " << my_info<decltype(p)>() \ ^ /home/jmairs/Documents/discovering_modern_cpp/c++11/template_type_deduction.cpp:55:5: note: in expansion of macro ‘info’ info(TPara, p);