Browse Source

putil: make ButtonHandle::none() constexpr

rdb 7 years ago
parent
commit
11ecd3af87

+ 0 - 9
panda/src/putil/buttonHandle.I

@@ -137,15 +137,6 @@ output(std::ostream &out) const {
   out << get_name();
   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.
  * ButtonHandle::none() evaluates to false, everything else evaluates to true.
  */
  */

+ 0 - 3
panda/src/putil/buttonHandle.cxx

@@ -14,9 +14,6 @@
 #include "buttonHandle.h"
 #include "buttonHandle.h"
 #include "buttonRegistry.h"
 #include "buttonRegistry.h"
 
 
-// This is initialized to zero by static initialization.
-ButtonHandle ButtonHandle::_none;
-
 TypeHandle ButtonHandle::_type_handle;
 TypeHandle ButtonHandle::_type_handle;
 
 
 /**
 /**

+ 1 - 2
panda/src/putil/buttonHandle.h

@@ -53,7 +53,7 @@ PUBLISHED:
 
 
   constexpr int get_index() const;
   constexpr int get_index() const;
   INLINE void output(std::ostream &out) const;
   INLINE void output(std::ostream &out) const;
-  INLINE static ButtonHandle none();
+  constexpr static ButtonHandle none() { return ButtonHandle(0); }
 
 
   INLINE operator bool () const;
   INLINE operator bool () const;
 
 
@@ -65,7 +65,6 @@ PUBLISHED:
 
 
 private:
 private:
   int _index;
   int _index;
-  static ButtonHandle _none;
 
 
 public:
 public:
   static TypeHandle get_class_type() {
   static TypeHandle get_class_type() {