1
如果我做的:如何斷點多個C++模板方法,就像非模板一樣?
(gdb) b nmspace::TestClass::compareFOO
然後下面的方法簽名將作爲斷點簽名:
nmspace::TestClass::compareFOO(blah::Foo const&, blah::Foo const&, unsigned int)
nmspace::TestClass::compareFOO(blah::Foo const&, blah::FooField const&, unsigned int)
nmspace::TestClass::compareFOO(blah::FooField const&, blah::Foo const&, unsigned int)
nmspace::TestClass::compareFOO(blah::FooField const&, blah::FooField const&, unsigned int)
有類似下面的內容,否則我們必須寫四個每次模板方法?多態還不適用於C++模板嗎?
nmspace::TestClass::compareFOOES<blah::Foo, blah::Foo>
nmspace::TestClass::compareFOOES<blah::Foo, blah::FooField>
nmspace::TestClass::compareFOOES<blah::FooField, blah::Foo>
nmspace::TestClass::compareFOOES<blah::FooField, blah::FooField>
我試過nmspace::TestClass::compareFOOES
,nmspace::TestClass::compareFOOES*
,nmspace::TestClass::compareFOOES<>()
等
非常有用,謝謝。 –