]> git.tdb.fi Git - libs/gui.git/commitdiff
Use constexpr instead of enum to define "typeless" constants
authorMikko Rasa <tdb@tdb.fi>
Sun, 27 Nov 2022 10:57:42 +0000 (12:57 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 27 Nov 2022 14:20:18 +0000 (16:20 +0200)
source/graphics/glcontext.h
source/input/gesturedetector.h
source/input/touchscreen.h

index 7f08f0e4026423e7d1b3b7c3dd657eae0ff781b1..c637b39e95308bdf6913e7c3dbbfc52de5f9839d 100644 (file)
@@ -11,11 +11,8 @@ class Window;
 
 struct GLOptions
 {
-       enum
-       {
-               DEFAULT_VERSION = 0,
-               LATEST_VERSION = 0xFFFFFFFF
-       };
+       static constexpr unsigned DEFAULT_VERSION = 0;
+       static constexpr unsigned LATEST_VERSION = 0xFFFFFFFF;
 
        bool alpha = false;
        bool stencil = false;
index 7f9726c8295ce5d223b93f241dd013f3918cabd9..0b31fd8c1c23aff34aad6914c0d23634566a6cdd 100644 (file)
@@ -30,10 +30,7 @@ absolute values greater than one.
 class GestureDetector: public Device
 {
 private:
-       enum
-       {
-               MAX_POINTS = 3
-       };
+       static constexpr size_t MAX_POINTS = 3;
 
        struct TouchPoint
        {
index 487a91c9760d66a93ea1bd6aceae51a78d1bcbed..d366a28f9f2c33c05f04369eb0601af1d34159a8 100644 (file)
@@ -11,10 +11,7 @@ namespace Input {
 class Touchscreen: public Device, public sigc::trackable
 {
 private:
-       enum
-       {
-               UNUSED = static_cast<unsigned>(-1)
-       };
+       static constexpr unsigned UNUSED = static_cast<unsigned>(-1);
 
        Graphics::Window &window;
        std::vector<unsigned> active_points;