vb 的 Nothing 的 C++CLI 等价物是什么?

What is the C++CLI equivalent of vb's Nothing?

我在这种地方

generic <typename ItemType> where ItemType : ItemBase
public ref class Container {
    ItemType GetItem(int i) {
        ...
        if (someSpecialCondition) return ???
        ...
    }
};

我想 return 等价于 vb 的 "Nothing" 但无法弄清楚它的语法。它不喜欢null或nullptr,我知道的很多。

这对于泛型来说非常不直观,请注意,如果类型参数是一个值 class,则它不能 nullptr。它也不符合语言规范,它承诺当类型被限制为 ref class.

时 nullptr 是有效的

类型 T 的默认值为 T()。原来是:

ItemType GetItem(int i) {
    ...
    if (someSpecialCondition) return ItemType();
    ...
}

如果 ItemType 是引用类型,则生成 nullptr;如果 ItemType 是值类型,则生成默认值(所有成员零初始化)。 Nothing 在 VB.NET

中所做的事情相同