You are here: CodeIdol.com > C++ > C++ Common Knowledge: Essential Intermediate Programming
C++ Common Knowledge: Essential Intermediate Programming
| Item 1. Data Abstraction A "type" is a set of operations, and an "abstract data type" is a set of operations with an implementation....
|
|
| Item 2. Polymorphism The topic of polymorphism is given mystical status in some programming texts and is ignored in others, but it's a simple,...
|
|
| Item 3. Design Patterns Anyone who is not already familiar with design patterns may, after a brief survey of the field, come away with...
|
|
| Item 4. The Standard Template Library A short description of the standard template library (STL) cannot do its design justice. What follows is an...
|
|
| Item 5. References Are Aliases, Not Pointers A reference is another name for an existing object. Once a reference is initialized with an object,...
|
|
| Item 6. Array Formal Arguments Array formal arguments are problematic. The major surprise in store for the C/C++ novice is that there are no...
|
|
| Item 7. Const Pointers and Pointers to Const In casual conversation, C++ programmers will often say "const pointer" when they really mean "pointer to...
|
|
| Item 8. Pointers to Pointers It's legal to declare a pointer to a pointer. This is what the C++ standard calls a "multilevel" pointer....
|
|
| Item 9. New Cast Operators There's something sneaky and underhanded about old-style casts. Their syntax is such that they can often pass unnoticed in...
|
|
| Item 10. Meaning of a Const Member Function Technically, const member functions are trivial. Socially, they can be complex. The type of the this...
|
|
| Item 11. The Compiler Puts Stuff in Classes C programmers are used to knowing everything there is to know about the internal structure and...
|
|
| Item 12. Assignment and Initialization Are Different Initialization and assignment are different operations, with different uses and different implementations. Let's get it absolutely straight....
|
|
| Item 13. Copy Operations Copy construction and copy assignment are different operations. Technically, they have nothing to do with each other, but socially they...
|
|
| Item 14. Function Pointers It's possible to declare a pointer to a function of a particular type. void (*fp)(int); // ptr to function Note...
|
|
| Item 15. Pointers to Class Members Are Not Pointers It's unfortunate that pointers to class members have the term "pointer" in their descriptions, because...
|
|
| Item 16. Pointers to Member Functions Are Not Pointers When you take the address of a non-static member function, you don't get an address;...
|
|
| Item 17. Dealing with Function and Array Declarators The main confusion with pointer to function and pointer to array declarations arises because the function...
|
|
| Item 18. Function Objects Often you'll need something that behaves like a function pointer, but function pointers tend to be unwieldy, dangerous, and (let's...
|
|
| Item 19. Commands and Hollywood When a function object is used as a callback, that's an instance of the Command pattern. What's a callback?...
|
|
| Item 20. STL Function Objects How did we ever get by without the STL? Not only is it easier and faster to write complex...
|
|
| Item 21. Overloading and Overriding Are Different Overloading and overriding have nothing whatsoever to do with each other. Nothing. They are entirely different concepts....
|
|
| Item 22. Template Method The Template Method pattern has nothing whatsoever to do with C++ templates. Rather, it's a way for a base class...
|
|
| Item 23. Namespaces Global scope was getting overly crowded. Everybody and his brother implemented libraries that reused the same names for different classes and...
|
|
| Item 24. Member Function Lookup When you call a member function, there are three steps involved. First, the compiler looks up the name of...
|
|
| Item 25. Argument Dependent Lookup Namespaces have a pervasive influence on modern C++ programs and designs (see Namespaces [23, 81]). Some of these influences...
|
|
| Item 26. Operator Function Lookup Sometimes it looks like a member operator function overloads a non-member operator, but this is not the case. It's...
|
|
| Item 27. Capability Queries Most times when an object shows up for work, it's capable of performing as required, because its capabilities are advertised...
|
|
| Item 28. Meaning of Pointer Comparison In C++, an object can have multiple, valid addresses, and pointer comparison is not a question about addresses....
|
|
| Item 29. Virtual Constructors and Prototype Suppose you find yourself in a Swedish restaurant, and you'd like to order a meal. Unfortunately, your knowledge...
|
|
| Item 30. Factory Method A high-level design often requires the creation of an object of the "appropriate" type, based on the type of an...
|
|
| Item 31. Covariant Return Types Generally, an overriding function must have the same return type as the function it overrides: class Shape { public:...
|
|
| Item 32. Preventing Copying Access specifiers (public, protected, and private) can be used to express and enforce higher-level constraints on how a type may...
|
|
| Item 33. Manufacturing Abstract Bases Abstract base classes typically represent abstract concepts from the problem domain, and therefore it doesn't make sense to declare...
|
|
| Item 34. Restricting Heap Allocation Sometimes it's a good idea to indicate that objects of a particular class should not be allocated on the...
|
|
| Item 35. Placement New It's impossible to call a constructor directly. However, we can trick the compiler into calling a constructor for us through...
|
|
| Item 36. Class-Specific Memory Management If you don't like the way standard operator new and operator delete are treating one of your class types,...
|
|
| Item 37. Array Allocation Most C++ programmers know to keep the array and nonarray forms straight when allocating and deallocating memory. T *aT =...
|
|
| Item 38. Exception Safety Axioms Writing an exception safe program or library is a little like proving a theorem in Euclidean geometry. Starting with...
|
|
| Item 39. Exception Safe Functions The hard part about writing exception safe code isn't the throwing or catching of exceptions; it's everything in between....
|
|
| Item 40. RAII The C++ community has a long and proud tradition of inscrutable abbreviations and odd names for techniques. RAII manages to attain...
|
|
| Item 41. New, Constructors, and Exceptions To write perfectly exception safe code, it's necessary to keep track of any allocated resources and to be...
|
|
| Item 42. Smart Pointers We C++ programmers are a loyal bunch. Whenever we're faced with a situation that requires a feature the language doesn't...
|
|
| Item 43. auto_ptr Is Unusual Whenever one discusses RAII, it's necessary to discuss auto_ptr. This is always a task. It's not that we're ashamed...
|
|
| Item 44. Pointer Arithmetic Pointer arithmetic is straightforward. To understand the nature of pointer arithmetic in C++, it's best to consider a pointer into...
|
|
| Item 45. Template Terminology Precise use of terminology is always important in any technical field, particularly in programming, most particularly in C++ programming, and...
|
|
| Item 46. Class Template Explicit Specialization Class template explicit specialization is straightforward. First, you need a general case to specialize. This general case is...
|
|
| Item 47. Template Partial Specialization Let's get it straight: you can't partially specialize function templates. It's just not a part of the C++ language...
|
|
| Item 48. Class Template Member Specialization A common misconception about class template explicit specialization and partial specialization is that a specialization somehow "inherits" something...
|
|
| Item 49. Disambiguating with Typename Even experienced C++ programmers are often put off by the rather complex syntax required to program with templates. Of...
|
|
| Item 50. Member Templates Class templates have members that are not themselves templates, and many of these members can be defined outside the class....
|
|
| Item 51. Disambiguating with Template In Disambiguating with Typename [49, 169], we saw how it is sometimes necessary to tell the compiler explicitly that...
|
|
| Item 52. Specializing for Type Information Class template explicit specialization and partial specialization are commonly used to produce versions of a primary class template...
|
|
| Item 53. Embedded Type Information How do we know the type of a container's elements? template <typename T> class Seq { //... }; At...
|
|
| Item 54. Traits Sometimes it's not enough to know just an object's type. Often, there is information related to the object's type that is...
|
|
| Item 55. Template Template Parameters Let's pick up the Stack template we considered in Specializing for Type Information [52, 183]. We decided to implement...
|
|
| Item 56. Policies In Specializing for Type Information [52, 183], we designed a stack template that deleted any remaining elements left in the stack...
|
|
| Item 57. Template Argument Deduction Class templates must be specialized explicitly. For example, if we want to specialize the Heap container discussed in Class...
|
|
| Item 58. Overloading Function Templates Function templates can be overloaded with other function templates and with nontemplate functions. This capability is useful but easy...
|
|
| Item 59. SFINAE In attempting to use function template argument deduction to select among a number of overloaded function templates and nontemplate functions, the...
|
|
| Item 60. Generic Algorithms A generic algorithm is a function template that is designed in such a way that it can be easily and...
|
|
| Item 61. You Instantiate What You Use In both C and C++, if you don't call a declared function (or take its address), you...
|
|
| Item 62. Include Guards Production C++ applications tend to use a lot of header files, and many header files include other header files. Under...
|
|
| Item 63. Optional Keywords Some keyword usage is strictly optional from the perspective of the C++ language, though other considerations may argue for their...
|
|
You are here: CodeIdol.com > C++ > C++ Common Knowledge: Essential Intermediate Programming
ADBRITE ads links
|
|
Related tags
Popular Categories
|