C++ã§ã¯é¢æ°ãªãã¸ã§ã¯ãã®ã»ããé¢æ°ããéããå¼ã³åºãã®æéã«å·®ãããæ§åã æ°åå¼ã¶ã ããªã誤差ã ãå¼ã¶åæ°ãå¢ããã¨ãã®é度ã¯æå©ã ã½ã¼ã std::sortã®æ¯è¼é¢æ°ã«é¢æ°ãé¢æ°ãªãã¸ã§ã¯ããä¸ããã é¢æ° bool cmp(int x, int y) { return x < y; } é¢æ°ãªãã¸ã§ã¯ã struct cmp_c { bool operator()(int x, int y) { return x < y; } } cmp; ãã¡ã³ã¯ã¿ã¨ããã¡ã³ã¯ã·ã§ãã¤ãã¨ãå¼ã°ãããcmpã¯ä¸ã®é¢æ°ã®cmpã¨åãããã«å¼ã¶ãã¨ãã§ããã ã©ã ãå¼ auto cmp = [](int x, int y) -> bool { return x < y; }; C++11ã®è¨æ³ãé¢æ°ãªãã¸ã§ã¯ããä½ãããã cmpã®åã¯function< bool(int,int) >ãã¨æãã
{{#tags}}- {{label}}
{{/tags}}