锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
http://blog.vckbase.com/jzhang/archive/2006/03/28/18807.html
CSDN鐨勬湅鍙嬪弬鑰冧簡Python鐨勫疄鐜版簮鐮佺粰鍑烘湁濡備笅鐨勮В絳旓細
http://blog.csdn.net/imjj/archive/2006/03/31/645163.aspx?Pending=true
鎬ц兘涓婂凡緇忔瘮Python濂戒簡錛屼絾鏄瑙g瓟姣曠珶鏄拡瀵逛簡鍏蜂綋鐨勫簲鐢紝姣斿瀹氭浜唄ash妗剁殑澶у皬涔嬬被鐨勩?br />
鎴戜篃鍑戠儹闂圭粰浜嗕竴涓疄鐜幫紝鍙嬌鐢ㄦ爣鍑咰++鐨勪竴浜涚畻娉曡В鍐蟲闂錛屾ц兘涓婅繕鏄病鏈塒ython濂斤紝浣嗘槸宸茬粡闈炲父鎺ヨ繎浜嗭細
D:\test\pytest>python test.py
2006-03-31 14:59:19.348000
2006-03-31 14:59:22.963000
D:\test\pytest>cpptest
緇忚繃浜?025.7888姣
瀹炵幇錛?br />#include <windows.h>聽聽聽聽聽聽//聽 just for time counting
#include <list>
#include <string>
#include <fstream>
#include <algorithm>
using namespace std;
int main( void )
{
聽__int64 t1, t2;
聽GetSystemTimeAsFileTime( (LPFILETIME)&t1 );
聽list<string> emails;
聽ifstream infile("email2.txt");
聽ofstream oufile("email_cpp.txt");
聽copy( istream_iterator<string>(infile), istream_iterator<string>(), back_inserter(emails) );
聽emails.unique();
聽ofstream outfile( "email_cpp.txt" );
聽copy( emails.begin(), emails.end(), ostream_iterator<string>(outfile,"\n") );
聽GetSystemTimeAsFileTime( (LPFILETIME)&t2 );
聽printf( "緇忚繃浜?I64d.%04I64d姣\n", (t2-t1)/10000, (t2-t1)%10000 );
}
瀵規瘮鐨勫叾浠栦袱涓疄鐜幫細
1銆乿ector + sort + unique
2銆乻et
鏈鍚庤繕鏄垜鐨勮繖涓疄鐜板ソ涓鐐癸細錛?br />PS錛氱紪璇戝櫒鐢ㄧ殑鏄疺C2005
鍐峆S錛屽啓浜嗕笂闈㈤偅涓狿S涔嬪悗紿佺劧鎯崇湅鐪媀C2003鎬庝箞鏍鳳紝浜庢槸嫻嬭瘯涓涓嬶紝鎯婁漢鐨勫彂鐜幫細
D:\test\pytest>cpptest2
緇忚繃浜?234.6512姣
閫熷害宸茬粡瓚呰秺浜哖ython
.^_^銆傛弧蹇冩鍠滅粨鏉熻繖涓璁烘梾紼?/p>
#include "stdafx.h"
using namespace std;
using namespace boost;
namespace
{
template<typename T> char checkSize(T*);
template<typename T> long checkSize(...);
}
template<typename FIRST, typename SECOND>
struct SameType
{
enum{value = sizeof(char) == sizeof(checkSize<FIRST>((SECOND*)0)) };
};
class IFoo
{
public:
virtual void bar() = 0;
};
class Foo: public IFoo
{
public:
virtual void bar(){ cout<<"bar()"<<endl; };
};
template<int>
class TypeSelect
{
public:
template<typename T>
TypeSelect(T& r){}
};
template<> class TypeSelect<true>
{
public:
template<typename T>
TypeSelect(T& r)
{
r.bar();
}
};
template<class T> void func( T& t )
{
(TypeSelect<SameType<IFoo, T>::value>(t));
}
int main()
{
Foo x;
int y;
func(x);
func(y);
}