[問題] 關於std:sort問題
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
bool cmp(int x , int y )
{
return x < y;
}
int main()
{
std::vector<int> test;
test.push_back( 1 );
test.push_back( 3 );
test.push_back( 2 );
sort( test.begin(), test.end(), cmp );
std::min( 1,2 );
return 0;
}
這一段 可以用
g++ test.cpp
gcc 4.4.0
gcc 4.5.2
這兩個都可以過
但奇怪的是sort沒加std::
不知道為什麼還能過 但min就一定要加std::
請問sort不是在std namespace中是刻意設計的嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.160.132.131
※ 編輯: wind00962 來自: 36.226.56.133 (10/17 20:46)
→
10/17 21:22, , 1F
10/17 21:22, 1F
→
10/17 21:22, , 2F
10/17 21:22, 2F
噓
02/18 14:44, , 3F
02/18 14:44, 3F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章