C++: combine const with template arguments

后端 未结 6 1497
清酒与你
清酒与你 2020-12-18 11:46

The following example is working when I manualy replace T wirh char *, but why is not working as it is:

template          


        
6条回答
  •  粉色の甜心
    2020-12-18 12:31

    Try converting to const T&. Also, in these cases, you should let the compiler automatically deduce the template argument, and not specify it.

提交回复
热议问题