diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2018-11-05 13:13:39 -0500 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2018-11-05 13:20:06 -0500 |
commit | 0da22fb0ada8a54fc59739057f281a406a993212 (patch) | |
tree | 7d7bd8394988b0d5f02e4ec0989eed58735a8f54 | |
parent | 03348ce0051cfae7172ac0d09b83ed5f82fa842a (diff) | |
download | harfbuzz-0da22fb0ada8a54fc59739057f281a406a993212.tar.gz |
[null] Tweak hb_nonnull_ptr_t some more
-rw-r--r-- | src/hb-null.hh | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/hb-null.hh b/src/hb-null.hh index c91af163..25a24f05 100644 --- a/src/hb-null.hh +++ b/src/hb-null.hh @@ -114,20 +114,14 @@ struct hb_nonnull_ptr_t inline hb_nonnull_ptr_t (T *v_ = nullptr) : v (v_) {} inline T * operator = (T *v_) { return v = v_; } - inline T * operator -> (void) { return get (); } - inline const T * operator -> (void) const { return get (); } - inline T & operator * (void) { return *get (); } - inline const T & operator * (void) const { return *get (); } - inline T ** operator & (void) { return &v; } - inline const T ** operator & (void) const { return &v; } - template <typename C> inline operator C * (void) { return get (); } + inline T * operator -> (void) const { return get (); } + inline T & operator * (void) const { return *get (); } + inline T ** operator & (void) const { return &v; } + /* Only auto-cast to const types. */ template <typename C> inline operator const C * (void) const { return get (); } - inline operator char * (void) { return (char *) get (); } inline operator const char * (void) const { return (const char *) get (); } - inline T * get (void) { return v ? v : const_cast<T *> (&Null(T)); } - inline const T * get (void) const { return v ? v : const_cast<T *> (&Null(T)); } - inline T * get_raw (void) { return v; } - inline const T * get_raw (void) const { return v; } + inline T * get (void) const { return v ? v : const_cast<T *> (&Null(T)); } + inline T * get_raw (void) const { return v; } T *v; }; |