zoukankan      html  css  js  c++  java
  • error C3225: generic type argument for 'T' cannot be 'System::Collections::Generic::KeyValuePair ^',

    //z 2012-6-19 14:38:56 PM IS2120@CSDN.T637923912

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

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

    but I'm getting the following error:

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

    //z 2012-6-19 14:38:56 PM IS2120@CSDN.T637923912
    I basically want to do this (C#)

    List<KeyValuePair<string, string>> thing;
    

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


    KeyValuePair does not itself need to be a handle. Duh.

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


    Figured it out:

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

    KeyValuePair does not itself need to be a handle. Duh.

    //z 2012-6-19 14:38:56 PM IS2120@CSDN.T637923912

    error C3191: '^' : incompatible with '/clr:oldSyntax' command line option

  • 相关阅读:
    day5 元组,字典,集合
    day4预习
    day4字符串、列表
    day3预习
    day3 数据类型
    day2 python 基础入门
    动态三角形(动态规划思想入门)
    百度之星资格赛
    Audiophobia(Floyd算法)
    Hat’s Words(字典树的运用)
  • 原文地址:https://www.cnblogs.com/IS2120/p/6745884.html
Copyright © 2011-2022 走看看