1

I have a header file defining some structs I want to use in my code.

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;
};

When I build this I get this error:

error C3986: 'mHeaders': signature of public member contains native type 'std::equal_to<_Ty>'
      with
      [
          _Ty=cpcpb::HttpHeader
      ] (SettingsServiceImpl.cpp)

What am I missing here? Isn't everything I'm using C++/Cx?

1 Answer 1

6

Use Windows::Foundation::Collections::IVector instead of Platform::Collections::Vector.

To use Platform::Collections::Vector you have to provide a custom comparator which is the equals operator.

Check this link - http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/5ec2090f-b7e6-40e8-9cd7-75cf36d05ab3/

Sign up to request clarification or add additional context in comments.

3 Comments

Futhermore, in C++/Cx, value types (value struct/value class) should only contain fundamental types, String^, and other value types. Other types are not permitted (at least by the RTM compiler, it is possible that with earlier releases the compiler incorrectly permits this).
So because IVector is not a fundamental type, my HttpRequestEvent struct isn't allowed. Is there a way to have a vector in a value struct then?
I do not believe there is a way to accomplish this. Is there a reason you cannot make HttpReqeustEvent a ref struct/class?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.