@[ass_wecan](/user/505805)
$vector:$
| $map$<${int,int}$> |
| :----------: |
|$map$<${int,int}$> |
|$map$<${int,int}$>|
|$map$<${int,int}$> |
```vector[int]=map<int,int>```
$map:$
| $vector$<${int,int}$> | $int$ |
| :----------: | :----------: |
| $vector$<${int,int}$> | $int$ |
| $vector$<${int,int}$> | $int$ |
| $vector$<${int,int}$> | $int$ |
```map[vector<int>]=int```
尖括号内侧是外侧的内容。
如果懂了的话尝试理解一下这个:
```int *(*p(int *a)[MAXN])```
by wangif424 @ 2022-09-28 01:04:23
1. `vector<map<int, int>>` 是以 `map<int, int>` 为元素的 `vector`。
2. `map<vector<int>, int>` 是以 `vector<int>` 为键、`int` 为值的 `map`。
一般地,如果 `a` 是模板,那么 `a<b>` 表示以 `b` 为参数的 `a` 实例。
---
@[wangif424](/user/521283) 有没有考虑过
* 函数不能返回数组。
* 这种代码一般写成 `auto p(int*) -> std::array<int**, MAXN>`。
by ud2_ @ 2022-09-28 01:40:39
@[ud2_](/user/206953) 函数可以返回指针
by _•́へ•́╬_ @ 2022-09-28 07:52:01
@[_•́へ•́╬_](/user/90693) 数组不是指针。
```plain
main.cpp:2:6: warning: unnecessary parentheses in declaration of 'p' [-Wparentheses]
2 | int *(*p(int *a)[MAXN]);
| ^~~~~~~~~~~~~~~~~~
main.cpp:2:6: note: remove parentheses
2 | int *(*p(int *a)[MAXN]);
| ^~~~~~~~~~~~~~~~~~
| - -
main.cpp:2:1: error: 'p' declared as function returning an array
2 | int *(*p(int *a)[MAXN]);
| ^~~
```
by ud2_ @ 2022-09-28 20:16:57
@[ud2_](/user/206953) 写错了,是这的```int *((*p(int *a))[MAXN]);```
by wangif424 @ 2022-09-29 22:39:28