JsonArray和Array API中使用const修饰符的不同行为

时间:2017-04-20 17:03:54

标签: windows uwp c++-cx

我正在做一些C ++ / CX开发。我使用两个不同的数组API有不同的行为。 Platform :: Array中的const修饰符允许我访问Length属性getter,但在Windows :: Data :: Json :: JsonArray中,在相同的情况下无法访问Size属性getter。微软的不同API对const修饰符的行为有不同的具体原因吗?

1 个答案:

答案 0 :(得分:0)

Platform::Array是C ++ / CX类型,可以使用C ++功能(如const)。 Windows::Data::Json::JsonArray是WinRT类型,只能使用WinRT功能,WinRT中没有const功能(因为并非所有语言都支持它)。