質問編集履歴
5
タグ追加
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
4
文章追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,8 +3,10 @@
|
|
3
3
|
同DLL内の他クラス内から参照する定数クラス作成を試みているところとなります。
|
4
4
|
|
5
5
|
## 質問
|
6
|
-
宣言時に初期化まで行うstd::mapを作成しようとしていますが、以下のエラーが発生します。
|
6
|
+
宣言時に初期化まで行う連想配列std::mapを作成しようとしていますが、以下のエラーが発生します。
|
7
7
|
対処方法があれば、ご教授願えないでしょうか。
|
8
|
+
※目的自体は連想配列作成になるため、std::mapにこだわるわけではありません。
|
9
|
+
|
8
10
|
エラーコード:C2440
|
9
11
|
メッセージ:
|
10
12
|
'初期化中': 'initializer list' から 'std::map<System::String ^,System::Nullable<int> ^,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>> *' に変換できません。
|
3
タグ誤り
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
2
誤記
title
CHANGED
File without changes
|
body
CHANGED
@@ -29,7 +29,7 @@
|
|
29
29
|
|
30
30
|
## 試してみたこと
|
31
31
|
①System::Collections::Generic::Dictionary型に型変更
|
32
|
-
⇒配列初期化子はC++/CLI配列型の配列化にのみ使用できます
|
32
|
+
⇒エラー「配列初期化子はC++/CLI配列型の配列化にのみ使用できます」が発生。
|
33
33
|
```C++
|
34
34
|
static Dictionary<System::String^, System::Nullable<int>> dic = gcnew Dictionary<System::String^,System::Nullable<int>>()
|
35
35
|
{
|
1
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
ref class constantClass
|
15
15
|
{
|
16
16
|
public:
|
17
|
-
static map<System::String^, System::Nullable<int>^>*
|
17
|
+
static map<System::String^, System::Nullable<int>^>* dic =
|
18
18
|
{
|
19
19
|
{ gcnew System::String("AAA"), gcnew System::Nullable<int>(1) },
|
20
20
|
{ gcnew System::String("BBB"), gcnew System::Nullable<int>(2) },
|
@@ -31,7 +31,7 @@
|
|
31
31
|
①System::Collections::Generic::Dictionary型に型変更
|
32
32
|
⇒配列初期化子はC++/CLI配列型の配列化にのみ使用できます
|
33
33
|
```C++
|
34
|
-
static Dictionary<System::String^, System::Nullable<int>>
|
34
|
+
static Dictionary<System::String^, System::Nullable<int>> dic = gcnew Dictionary<System::String^,System::Nullable<int>>()
|
35
35
|
{
|
36
36
|
{ gcnew System::String("AAA"), gcnew System::Nullable<int>(1) },
|
37
37
|
{ gcnew System::String("BBB"), gcnew System::Nullable<int>(2) },
|