TIPS FOR C++3
[1]Define operators primarily to mimic conventional usage; [2]For large operands,use const reference argument types; [3]For large results,consider optimizing the return; [4]Prefer the default copy operations if appropriate for a class; [5]Redefine or prohibit copying if the default is not appropriate for a type; [6]Prefer member functions over nonmembers for operations that need access to the representation; [7]Prefer nonmember functions over members for operations that do not need access to the representation; [8]Use namespaces to associate helper functions with "their" class; [9]Use nonmember functions for symmetric operators; [10]Use () for subscripting multidimensional arrays; [11]Make constructors that take a single "size argument" explicit; [12]For non-specialized uses,prefer the standard string to the result of your own exercises; [13]Be cauious about introducing implicit conversions; [14]Use member functions to express operators that require an lvalue as its left-hand operand;本文出自 51CTO.COM技术博客 |



virus
博客统计信息
热门文章
最新评论
友情链接