[問題] c++語法
開發平台(Platform): (Ex: Win10, Linux, ...)
Linux
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
GCC
問題(Question):
請問m4這個lamda初始化Cmp是什麼語法??
在書上看到這段code可是沒解釋這段的寫法,這個就我的理解,
好像也不是List initialization ?
可以不管前面兩個參數直接匹配到Cmp??
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
// g++ std-map.cpp -o a.out -std=c++11
#include <iostream>
#include <string>
#include <map>
using namespace std;
using Cmp = bool(*)(const int&,const int&);
int main() {
map<int,int,Cmp> m4{[](const int &a,const int &b){return a>b;}};
return 0;
}
感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 27.242.38.14 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1622989915.A.E37.html
→
06/06 22:37,
4年前
, 1F
06/06 22:37, 1F
→
06/06 22:37,
4年前
, 2F
06/06 22:37, 2F
→
06/08 19:14,
4年前
, 3F
06/08 19:14, 3F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章