Generic generics in managed C ++

I want to create a KeyValuePair List in a C ++ managed project. Here is the syntax I'm using

List<KeyValuePair<String^, String^>^>^ thing; 

but I get the following error:

error C3225: the generic type argument for 'T' cannot be "System :: Collections :: Generic :: KeyValuePair ^", it must be a value type or a handle to a reference type

I basically want to do this (C #)

 List<KeyValuePair<string, string>> thing; 

but in managed C ++. Oh and in .Net 2.0. Any members?

+2
source share
2 answers

KeyValuePair itself should not be a descriptor. Duh.

Because it is a value type, not a reference type (i.e. struct instead of class in C #).

+2
source

It revealed:

 List<KeyValuePair<String^, String^>>^ thing; 

KeyValuePair itself should not be a descriptor. Duh.

+3
source

All Articles