putil: make ButtonHandle::none() constexpr

This commit is contained in:
rdb 2018-09-04 12:01:34 +02:00
parent 809f9b04f6
commit 11ecd3af87
3 changed files with 1 additions and 14 deletions

View File

@ -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.
*/ */

View File

@ -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;
/** /**

View File

@ -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() {