
On Tue, Aug 21, 2012 at 15:09:02 -0400, Roger Martin wrote:
Run into many template and friend issues. Anybody getting this lib to work?
Much coming from https://svn.boost.org/svn/boost/sandbox/SOC/2007/visualization/boost/svg_plo.... First two: .............. In file included from ../../testing-grounds/divcon-support_libs/local/r.linux-x86_64.gcc-shared/include/boost/svg_plot/svg_2d_plot.hpp:32:0, from tests/plotting_tests.cpp:21: ../../testing-grounds/divcon-support_libs/local/r.linux-x86_64.gcc-shared/include/boost/svg_plot/uncertain.hpp:241:11: required from here ../../testing-grounds/divcon-support_libs/local/r.linux-x86_64.gcc-shared/include/boost/svg_plot/uncertain.hpp:97:24: error: template-id ‘operator<< <>’ for ‘std::ostream& boost::svg::operator<<(std::ostream&, const boost::svg::unc<false>&)’ does not match any template declaration ../../testing-grounds/divcon-support_libs/local/r.linux-x86_64.gcc-shared/include/boost/svg_plot/uncertain.hpp:102:24: error: template-id ‘operator<< <>’ for ‘std::ostream& boost::svg::operator<<(std::ostream&, const std::pair<boost::svg::unc<false>, boost::svg::unc<false> >&)’ does not match any template declaration ..............
It's making friends with templates that don't exist. I don't think the involved templates can work in any compler, ever. There is however big difference between Gcc and Visual C++ in treating of templates. Gcc parses everything as it comes across it and insists that it's well-formed, while VC++ delays lot of it until instantiation, apparently in an attempt to relieve programmers from having to write `typename` and `template` in many cases. That means Gcc will complain about things like this while VC++ won't. However the templates seem pretty bogus. There is a template <bool correlated> class unc; followed up by template<typename correlated> std::ostream& operator<< (std::ostream& os, const unc<false>& u); followed up by friend std::ostream& operator<< <> (std::ostream& os, const unc<correlated>& u); and that simply does not add up under any compiler. The middle template is not using it's template argument in it's signature, so it's neither possible to give it's specialization as the friend declaration is trying to do, nor is it actually useful, because you'd need to give the template parameter explicitly, so the only possible call syntax is operator<< <whatever> (out, u) and that certainly does not look like what was intended. So I suggest you just try to comment the offending declarations out and see if it gets you somewhere. -- Jan 'Bulb' Hudec <bulb@ucw.cz>