浏览代码

putil: make ButtonHandle::none() constexpr

rdb 7 年之前
父节点
当前提交
11ecd3af87
共有 3 个文件被更改,包括 1 次插入14 次删除
  1. 0 9
      panda/src/putil/buttonHandle.I
  2. 0 3
      panda/src/putil/buttonHandle.cxx
  3. 1 2
      panda/src/putil/buttonHandle.h

+ 0 - 9
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.
  */

+ 0 - 3
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;
 
 /**

+ 1 - 2
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() {