From f013c1b22dd77dce45b2d359f97bdf0bceda6349 Mon Sep 17 00:00:00 2001 From: hsutter Date: Tue, 29 Dec 2015 10:39:36 -0800 Subject: [PATCH] Applied suggestion in PR #298. --- CppCoreGuidelines.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index f92117f..05e8292 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -2840,8 +2840,21 @@ The language guarantees that a `T&` refers to an object, so that testing for `nu ##### Example - ??? - + class car + { + array w; + // ... + public: + wheel& get_wheel(size_t i) { Expects(i<4); return w[i]; } + // ... + }; + + void use() + { + car c; + wheel& w0 = c.get_wheel(0); // w0 has the same lifetime as c + } + ##### Enforcement ???