diff options
author | Max Kellermann <max@duempel.org> | 2014-12-09 23:07:43 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-12-09 23:07:43 +0100 |
commit | 3ab0691eecac239aee9b780928438a7df7d8394d (patch) | |
tree | 416bef9a92ee3f9c4bded9b42141ed92edcc120c /src/util | |
parent | 1e073a196fa011e1581ebe8ead3823f8322257ca (diff) | |
download | mpd-3ab0691eecac239aee9b780928438a7df7d8394d.tar.gz mpd-3ab0691eecac239aee9b780928438a7df7d8394d.tar.xz mpd-3ab0691eecac239aee9b780928438a7df7d8394d.zip |
Util/Manual: add method Get()
May be more clear than operators.
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/Manual.hxx | 16 |
1 files changed, 12 insertions, 4 deletions
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(); } }; |