Util/Manual: add method Get()

May be more clear than operators.
This commit is contained in:
Max Kellermann 2014-12-09 23:07:43 +01:00
parent 1e073a196f
commit 3ab0691eec
1 changed files with 12 additions and 4 deletions

View File

@ -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();
}
};