Skip to content

Commit

Permalink
Use std::conditional_t for Glib::Variant<(u)int64> rather than LONG_T…
Browse files Browse the repository at this point in the history
…YPE_SIZE
  • Loading branch information
ilya-fedin authored and john-preston committed Dec 8, 2022
1 parent a67223e commit 1df4417
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions base/platform/linux/base_linux_glibmm_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@

#include <glibmm/variant.h>

#if LONG_TYPE_SIZE == 64
namespace Glib {

struct Int64Helper0 {};
using Int64Helper = std::conditional_t<std::is_same_v<gint64, int64>, Int64Helper0, int64>;

struct UInt64Helper0 {};
using UInt64Helper = std::conditional_t<std::is_same_v<guint64, uint64>, UInt64Helper0, uint64>;

template <>
class Variant<int64> : public VariantBase {
class Variant<Int64Helper> : public VariantBase {
public:
using CType = gint64;

Expand Down Expand Up @@ -58,7 +63,7 @@ class Variant<int64> : public VariantBase {
};

template <>
class Variant<uint64> : public VariantBase {
class Variant<UInt64Helper> : public VariantBase {
public:
using CType = guint64;

Expand Down Expand Up @@ -102,7 +107,6 @@ class Variant<uint64> : public VariantBase {
};

} // namespace Glib
#endif // LONG_TYPE_SIZE == 64

namespace base {
namespace Platform {
Expand Down

0 comments on commit 1df4417

Please sign in to comment.