From 3ab0691eecac239aee9b780928438a7df7d8394d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 9 Dec 2014 23:07:43 +0100 Subject: Util/Manual: add method Get() May be more clear than operators. --- src/util/Manual.hxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/util') diff --git a/src/util/Manual.hxx b/src/util/Manual.hxx index dd5b7e02f..7b1023f41 100644 --- a/src/util/Manual.hxx +++ b/src/util/Manual.hxx @@ -92,20 +92,28 @@ public: #endif } - operator T &() { + T &Get() { return *(T *)data; } - operator const T &() const { + const T &Get() const { return *(const T *)data; } + operator T &() { + return Get(); + } + + operator const T &() const { + return Get(); + } + T *operator->() { - return (T *)data; + return &Get(); } const T *operator->() const { - return (T *)data; + return &Get(); } }; -- cgit v1.2.3