c++ - Eclipse "implement method" function will not work with a template class -
i have been using eclipse quite time, have used c++ programming. bunch of fun figuring out how actual compile c++ on eclipse on system, have figured out 100% success, have stumbled upon annoying issue. have seen if create class in header file can use nifty tool under source menu called "implement method" take function declarations header file , place them in source file body ready code.
well today messing around new code , needed template class working on, behold when tried use implement method function find eclipse tells me there "no implement file found 1 or more methods" , instead creates inline function in header file (like need that!). bug in eclipse or there underlying c++ rule cannot avoided? dont seem understand why having class declration class foo{};
work fine, having template <typename t> class foo{};
causes error. know issue becuase if declare normal class 1 public function works, if take same class , declare template class find error occurs again.
tldr:
eclipse "implement method" place declared fucntion in header file source file ready code if class declared class foo{};
fails if class declared template <typename t> class foo{};
when tried use implement method function find eclipse tells me there "no implement file found 1 or more methods" , instead creates inline function in header file (like need that!). bug in eclipse or there underlying c++ rule cannot avoided?
no, it's not bug, needed (as noticed).
it's c++ rule template definitions must seen header file.
so there's no source file can deduced eclipse template class.
you can though setup file types .tcc
or .icc
files c++ source, , include these template class header (i'm not sure if eclipse clever enough place auto implementations there atm, i'm pretty sure usual switching between source , header works such setup).