From 11ecd3af87d4d25d41eb447f559075d191710c79 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 4 Sep 2018 12:01:34 +0200 Subject: [PATCH] putil: make ButtonHandle::none() constexpr --- panda/src/putil/buttonHandle.I | 9 --------- panda/src/putil/buttonHandle.cxx | 3 --- panda/src/putil/buttonHandle.h | 3 +-- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/panda/src/putil/buttonHandle.I b/panda/src/putil/buttonHandle.I index c45145dd40..55edc7f61a 100644 --- a/panda/src/putil/buttonHandle.I +++ b/panda/src/putil/buttonHandle.I @@ -137,15 +137,6 @@ output(std::ostream &out) const { out << get_name(); } -/** - * Returns a special zero-valued ButtonHandle that is used to indicate no - * button. - */ -INLINE ButtonHandle ButtonHandle:: -none() { - return _none; -} - /** * ButtonHandle::none() evaluates to false, everything else evaluates to true. */ diff --git a/panda/src/putil/buttonHandle.cxx b/panda/src/putil/buttonHandle.cxx index 831a3daddd..4ce3cd5a91 100644 --- a/panda/src/putil/buttonHandle.cxx +++ b/panda/src/putil/buttonHandle.cxx @@ -14,9 +14,6 @@ #include "buttonHandle.h" #include "buttonRegistry.h" -// This is initialized to zero by static initialization. -ButtonHandle ButtonHandle::_none; - TypeHandle ButtonHandle::_type_handle; /** diff --git a/panda/src/putil/buttonHandle.h b/panda/src/putil/buttonHandle.h index ad43ad2a86..6e9dd9a40f 100644 --- a/panda/src/putil/buttonHandle.h +++ b/panda/src/putil/buttonHandle.h @@ -53,7 +53,7 @@ PUBLISHED: constexpr int get_index() const; INLINE void output(std::ostream &out) const; - INLINE static ButtonHandle none(); + constexpr static ButtonHandle none() { return ButtonHandle(0); } INLINE operator bool () const; @@ -65,7 +65,6 @@ PUBLISHED: private: int _index; - static ButtonHandle _none; public: static TypeHandle get_class_type() {