考虑到C++模板混入结构,我如何编写一个函数来接收特定组件的混入?在这个例子中,我怎么给withAandB至worksWithA()?structBase{};templatestructHasA:T{intA;};templatestructHasB:T{intB;};voidWorksWithA(HasA&p){p.A++;}voidWorksWithAandB(HasA>&p){p.A++;p.B++;}int_tmain(intargc,_TCHAR*argv[]){HasAwithA;HasA>withAandB;WorksWithA(withA);//OKWorksWith