Implicit Template Parameters

后端 未结 7 925
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-07 15:00

The following code generates a compile error in Xcode:

template 
struct Foo
{
    Foo(T Value)
    {
    }
};

int main()
{
    Foo MyFoo(123);         


        
7条回答
  •  醉话见心
    2021-02-07 15:41

    It's not a bug, it's non-existing feature. You have to fully specify class/structure template arguments during instantiation, always, the types are not inferred as they can be for function templates.

提交回复
热议问题