It took me a long time to realize how important and subtle having variables that:
1) exist on the stack
2) have their destructors called when they fall out of scope
are.
These two things allow things like:
A) RAII
B) refcounted GC
Interesting enough, (1) & (2) are not available in "lower" languages like C/Assembly; nor in "higher" languages like Ruby/Python/Java (since GC prevents predictable destruction of objects).
I'm curious -- what other techniques do you know of that are very C++ specific, due to language design choices.
Thanks!
Edit: If your answer is "this works in C++ & this other langauge", that's okay too. The things I want to learn about are similar to:
By choosing to not have certain features (like GC), we gain other features (like RAII + predicable destructing of objects). In what areas of C++, by choosing to NOT have features that other "higher level" langauges have, C++ manages to get patterns that those higher level langauges can't express.
Yes and no. Certain design patterns are not specific to particular languages, but there may be design patterns specific to classes of languages. For example, there may be functional design patterns that are specific to functional languages or object oriented design patterns specific to object oriented languages.
There are various patterns in the C language like star patterns, number patterns, and character patterns.
A pattern program in C generally contains nested loops where the outer loop controls the number of rows, and the inner loop controls the data in each row containing the contents to be printed.
An organized collection of design patterns that relate to a particular field is called a pattern language. This language gives a common terminology for discussing the situations designers are faced with. The elements of this language are entities called patterns.
curiously recurring template pattern
expression templates
Probably the whole meta-programming concept as well
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With