TIPS FOR C++3

发布时间:2019-08-25 09:33:53编辑:auto阅读(1309)

    [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;

关键字

上一篇: 3G来了!!

下一篇: Windows上Python安装及Pow