From 45e11be0ad7a828ddb841d7a1cc84e2a2fe71b7e Mon Sep 17 00:00:00 2001 From: Bjarne Stroustrup Date: Sun, 2 Apr 2017 14:36:21 -0400 Subject: [PATCH] added example to C.136 --- CppCoreGuidelines.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 42c5810..6d4f14c 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -6447,7 +6447,6 @@ To make this interface useful, we must provide its implementation classes (here, Now `Shape` is a poor example of a class with an implementation, but bear with us because this is just a simple example of a technique aimed at more complex hierarchies. - class Impl::Circle : public Circle, public Impl::Shape { // implementation public: // constructors, destructor @@ -6697,6 +6696,13 @@ If the operations are virtual the use of inheritance is necessary, if not using This a relatively rare use because implementation can often be organized into a single-rooted hierarchy. +##### Example + +Sometimes, an "implementation attribute" is more like a "mixin" that determine the behavior of an implementation and inject +members to enable the implementation of the policies it requires. +For example, see `std::enable_shared_from_this` +or various bases from boost.intrusive (e.g. `list_base_hook` or `intrusive_ref_counter`). + ##### Enforcement ???