C++11模板类编译正常但输出异常,请求技术支援
Alright, let's tackle this head-on—compiles fine but spits out wonky output? That's the kind of subtle bug that makes you squint at your screen for 20 minutes, but we'll get it sorted.
First off, since you mentioned modifying the template class from svg-curve-lib (even just tiny tweaks), and the original works fine, the issue is almost certainly tied to those changes or how you're using the x_getter struct in your main() code. To narrow this down, can you share:
- A stripped-down, runnable version of your
main()that reproduces the weird output—no extra fluff, just the code that triggers the issue - The exact unexpected output you're seeing (copy-paste the full line(s) if you can)
- The specific modifications you made to the original template class—even something like changing a default template parameter or adjusting a member's initialization can throw things off
- Your compiler and version (GCC, Clang, MSVC? And which version number?)
For example, if the x_getter struct is printing garbage values, it might be an uninitialized member variable that the original library handled properly but your tweak broke. Or maybe you're instantiating the template with a type that the library didn't account for in its original code.
Once you drop those details, we can zero in on the problem and fix that output anomaly!
内容的提问来源于stack exchange,提问作者whoever11

