《Effective Modern C++ 简体中文版》的原文摘录

  • ......create softerware that's correct efficient maintainable portable (查看原文)
    晨星 2019-05-03 23:54:45
    —— 引自第1页
  • C++98 had a single set of rules for type deduction: the one for function templates. C++11 modifies that ruleset a bit and add two more, one for auto and one for decltype. C++14 then extends the usage contexts in which auto and decltype may be employed. (查看原文)
    晨星 2019-05-03 23:58:38
    —— 引自第9页
  • When users of a complex system are ignorant of how it works, yet happy with what it does, that says a lot about the design of the system. By this measure, template type deduction in C++ is a tremendous success. (查看原文)
    晨星 2019-05-04 00:07:37
    —— 引自第9页
  • The ability to declare references to arrays enables creation of a template that deduces the number of elements that an array contains. (查看原文)
    晨星 2019-05-04 23:31:31
    —— 引自第19页
  • The only real difference between auto and template type deduction is that auto assumes that a braced initializer represents a std::initializer_list, but the template type deduction doesn't. (查看原文)
    晨星 2019-05-05 23:15:27
    —— 引自第22页
  • In C++11, perhaps the primary use for decltype is declaring function templates where the function's return type depends on its parameter types. (查看原文)
    晨星 2019-05-05 23:17:42
    —— 引自第24页
  • The use of "decltype(auto)" is not limited to function return type. I can also be convenient for declaring variables when you want to apply the decltype type deduction rules to the initializing expression. (查看原文)
    晨星 2019-05-08 01:27:49
    —— 引自第26页
  • Employing pass-by-value for objects of an unknown type generally risks the performance hit of unnecessary copying, the behavioral problems of object slicing, and ... (查看原文)
    晨星 2019-05-08 01:31:04
    —— 引自第28页
  • As a general rule, "invisible" proxy classes don't play well with auto. Objects of such classes are often not designed to live longer than a single statement, so creating variables of those types tends to violate fundemental library design assumptions. (查看原文)
    晨星 2019-05-10 00:11:02
    —— 引自第45页
  • I'll generally ignore the equals-sign-plus-braces syntax, because C++ usually treat it the same as the braces-only version. (查看原文)
    晨星 2019-08-03 00:31:03
    —— 引自第49页
  • It's best to design your constructors so that the overload called isn't affected by whether clients use parentheses or braces. (查看原文)
    晨星 2019-08-03 00:37:09
    —— 引自第56页
  • Braces-by-defult folks are attracted by their unrivaled breadth of applicability, their prohibition of narrowing conversions, and their immunity to C++'s most vexing parse. The parentheses crowd are attracted to tis consistency with the C++ 98 syntactic tradition, its avoidance of the auto-deduced-a-std::initializer_list problem, and the knowledge that their object creation calls won't be inadvertently waylaid by std::initializer_list constructors. (查看原文)
    晨星 2019-08-03 00:40:39
    —— 引自第57页
  • Alias declarations may be templatized (in which case they're called alias templates), while typedefs cannot. (查看原文)
    晨星 2019-08-05 00:01:09
    —— 引自第63页
  • For each C++11 transformation<T>::type, there's a corresponding C++14 alias template named transformation_t. (查看原文)
    晨星 2019-08-05 00:02:38
    —— 引自第66页
  • Both scoped and unscoped enums support specification of the underlying type. (查看原文)
    晨星 2019-08-05 00:06:24
    —— 引自第74页
  • The default underlying type for scoped enums is int. Unscoped enums have no default underlying type. (查看原文)
    晨星 2019-08-05 00:06:24
    —— 引自第74页
  • By convesion, deleted functions are declared public, not private. (查看原文)
    晨星 2019-08-08 01:21:27
    —— 引自第75页
  • An important advantage of deleted functions is that any functions may be deleted, while only member functions may be private. (查看原文)
    晨星 2019-08-08 01:22:42
    —— 引自第76页
  • Although deleted functions can't be used, they are part of your program. As such, they are taken into account during overload resolution. (查看原文)
    晨星 2019-08-08 01:23:53
    —— 引自第76页
  • Member function reference qualifiers make it possible to limit use of a member function to lvalues only or to rvalues only. (查看原文)
    晨星 2019-08-08 01:25:29
    —— 引自第80页
<前页 1 2 3 4 后页>