Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows runtime 在c+中的结构中使用结构向量+/cx_Windows Runtime_C++ Cx - Fatal编程技术网

Windows runtime 在c+中的结构中使用结构向量+/cx

Windows runtime 在c+中的结构中使用结构向量+/cx,windows-runtime,c++-cx,Windows Runtime,C++ Cx,我有一个头文件,它定义了我想在代码中使用的一些结构 public value struct HttpHeader { Platform::String^ mName; Platform::String^ mValue; }; typedef Platform::Collections::Vector<HttpHeader> HttpHeaders; public value struct HttpRequestEvent { Platform::String^

我有一个头文件,它定义了我想在代码中使用的一些结构

public value struct HttpHeader
{
   Platform::String^ mName;
   Platform::String^ mValue;

};
typedef Platform::Collections::Vector<HttpHeader> HttpHeaders;

public value struct HttpRequestEvent
{
   Platform::String^ mUri;
   HttpHeaders^ mHeaders;
};
公共值结构HttpHeader
{
平台::字符串^mName;
平台::字符串^M值;
};
typedef平台::集合::向量HttpHeaders;
公共值结构HttpRequestEvent
{
平台::字符串^mUri;
HttpHeaders^mHeaders;
};
当我构建此文件时,会出现以下错误:

error C3986: 'mHeaders': signature of public member contains native type 'std::equal_to<_Ty>'
      with
      [
          _Ty=cpcpb::HttpHeader
      ] (SettingsServiceImpl.cpp)
错误C3986:“mHeaders”:公共成员的签名包含本机类型“std::equal_to”
具有
[
_Ty=CPB::HttpHeader
](设置ServiceImpl.cpp)

我错过了什么?我使用的不是C++/Cx吗?

使用
Windows::Foundation::Collections::IVector
而不是
Platform::Collections::Vector

要使用
Platform::Collections::Vector
,您必须提供一个自定义比较器,它是equals运算符


检查此链接-

使用
Windows::Foundation::Collections::IVector
而不是
Platform::Collections::Vector

要使用
Platform::Collections::Vector
,您必须提供一个自定义比较器,它是equals运算符


检查此链接-

此外,在C++/Cx中,值类型(值结构/值类)应仅包含基本类型、字符串^和其他值类型。其他类型是不允许的(至少RTM编译器是不允许的,早期版本的编译器可能不正确地允许这种情况)。因此,由于IVector不是基本类型,因此不允许使用我的HttpRequestEvent结构。那么,有没有办法在值结构中有一个向量呢?我不相信有办法做到这一点。有没有理由不能将HttpRequestEvent设置为ref结构/类?此外,在C++/Cx中,值类型(值结构/值类)应仅包含基本类型、字符串^和其他值类型。其他类型是不允许的(至少RTM编译器是不允许的,早期版本的编译器可能不正确地允许这种情况)。因此,由于IVector不是基本类型,因此不允许使用我的HttpRequestEvent结构。那么,有没有办法在值结构中有一个向量呢?我不相信有办法做到这一点。有没有理由不能将HttpRequestEvent设置为ref结构/类?