Ray's playground

 

2011年3月14日

boost::addressof

摘要: #include<iostream>#include<boost/utility.hpp>usingnamespacestd;classObject{public:inti;Object():i(0x11223344){}intoperator&(){return0;}};intmain(){Objectobj;cout<<&obj<<endl;Object*p=boost::addressof(obj);Object*p1=std::addressof(obj);cout<<p<<endl;cout< 阅读全文

posted @ 2011-03-14 22:53 Ray Z 阅读(374) 评论(0) 推荐(0) 编辑

Project Euler Problem 22

摘要: Usingnames.txt(right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a na 阅读全文

posted @ 2011-03-14 14:10 Ray Z 阅读(258) 评论(0) 推荐(0) 编辑

Printing(Chapter 27 of Cocoa Programming for Mac OS X)

摘要: 1#import"PeopleView.h"2#import"Person.h"34@implementationPeopleView56-(id)initWithPeople:(NSArray*)persons7{8[superinitWithFrame:NSMakeRect(0,0,700,700)];9people=[personscopy];10attributes=[[NSMutableDictionaryalloc]init];11NSFont*font=[NSFontfontWithName:@"Monaco"size: 阅读全文

posted @ 2011-03-14 11:43 Ray Z 阅读(273) 评论(0) 推荐(0) 编辑

Numbers(Chapter 5 of Objective-C Phrasebook)

摘要: 1#import<Foundation/Foundation.h>23intmain(intargc,constchar*argv[])4{56NSAutoreleasePool*pool=[[NSAutoreleasePoolalloc]init];78NSString*test=@"Shanghai;40.00;RayZhang;";9NSScanner*scanner=[NSScannerscannerWithString:test];1011NSString*location;12floatnumber;1314NSCharacterSet*charac 阅读全文

posted @ 2011-03-14 10:39 Ray Z 阅读(201) 评论(0) 推荐(0) 编辑

导航