Ray's playground

 

2011年3月24日

bitset

摘要: 1#include<iostream>2#include<bitset>3usingnamespacestd;45intmain()6{7bitset<16>a(0xff01);8cout<<"a:"<<a<<endl;910bitset<32>b("100010");11cout<<"b:"<<b<<endl;12cout<<"countofb:"<<b.count()& 阅读全文

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

Item 20: Prefer pass-by-reference-to-const to pass-by-value(Effective C++)

摘要: Prefer pass-by-reference-to-const over pass-by-value. It's typically more efficient and it avoids the slicing problem. The rule doesn't apply to built-in types and STL iterator and function object types. For them, pass-by-value is usually appropriate. 阅读全文

posted @ 2011-03-24 21:35 Ray Z 阅读(167) 评论(0) 推荐(0) 编辑

Item 19: Treat class design as type design(Effective C++)

摘要: Class design is type design. Before defining a new type, be sure to consider all the issues discussed in this Item. 阅读全文

posted @ 2011-03-24 20:54 Ray Z 阅读(167) 评论(0) 推荐(0) 编辑

Item 18: Make interfaces easy to use correctly and hard to use incorrectly(Effective C++)

摘要: Good interfaces are easy to use correctly and hard to use incorrectly. Your should strive for these characteristics in all your interfaces. Ways to facilitate correct use include consistency in interfaces and behavioral compatibility with built-in types. Ways to prevent errors include creating new . 阅读全文

posted @ 2011-03-24 18:09 Ray Z 阅读(189) 评论(0) 推荐(0) 编辑

导航