[問題] std::sort??
test.cpp 檔如下
#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: 203.192.162.252
※ 編輯: Arton0306 來自: 203.192.162.252 (02/23 14:29)
推
02/23 20:28, , 1F
02/23 20:28, 1F
推
02/24 06:43, , 2F
02/24 06:43, 2F
推
02/24 06:44, , 3F
02/24 06:44, 3F
推
02/24 19:50, , 4F
02/24 19:50, 4F
推
02/24 20:41, , 5F
02/24 20:41, 5F
→
02/24 20:42, , 6F
02/24 20:42, 6F
→
02/24 20:47, , 7F
02/24 20:47, 7F
→
02/24 20:48, , 8F
02/24 20:48, 8F
→
02/24 20:49, , 9F
02/24 20:49, 9F
→
02/27 01:36, , 10F
02/27 01:36, 10F