aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2021-11-02 00:44:51 -0600
committerBehdad Esfahbod <behdad@behdad.org>2021-11-02 00:44:51 -0600
commit7a078c395a57097a2ae204c0089f47a9ac97d849 (patch)
tree521643f2387f50cb789301b804b41a08e1d2189d
parent943921cf0caefa564601f7b18eed2168be77cfda (diff)
downloadharfbuzz_ng-7a078c395a57097a2ae204c0089f47a9ac97d849.tar.gz
[meta] Use std::conditional instead of hb_conditional()
-rw-r--r--src/hb-meta.hh13
-rw-r--r--src/hb-open-type.hh2
2 files changed, 3 insertions, 12 deletions
diff --git a/src/hb-meta.hh b/src/hb-meta.hh
index 3808d917b..4ec3702bf 100644
--- a/src/hb-meta.hh
+++ b/src/hb-meta.hh
@@ -132,15 +132,6 @@ template <typename T> using hb_add_pointer = decltype (_hb_try_add_pointer<T> (h
/* TODO Add feature-parity to std::decay. */
template <typename T> using hb_decay = hb_remove_const<hb_remove_reference<T>>;
-
-template<bool B, class T, class F>
-struct _hb_conditional { typedef T type; };
-template<class T, class F>
-struct _hb_conditional<false, T, F> { typedef F type; };
-template<bool B, class T, class F>
-using hb_conditional = typename _hb_conditional<B, T, F>::type;
-
-
template <typename From, typename To>
struct hb_is_convertible
{
@@ -150,7 +141,7 @@ struct hb_is_convertible
static constexpr bool either_void = from_void || to_void;
static constexpr bool both_void = from_void && to_void;
- static hb_true_type impl2 (hb_conditional<to_void, int, To>);
+ static hb_true_type impl2 (typename std::conditional<to_void, int, To>::type);
template <typename T>
static auto impl (hb_priority<1>) -> decltype (impl2 (hb_declval (T)));
@@ -159,7 +150,7 @@ struct hb_is_convertible
public:
static constexpr bool value = both_void ||
(!either_void &&
- decltype (impl<hb_conditional<from_void, int, From>> (hb_prioritize))::value);
+ decltype (impl<typename std::conditional<from_void, int, From>::type> (hb_prioritize))::value);
};
#define hb_is_convertible(From,To) hb_is_convertible<From, To>::value
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 1504584f1..7e524177f 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -64,7 +64,7 @@ struct IntType
IntType& operator = (Type i) { v = i; return *this; }
/* For reason we define cast out operator for signed/unsigned, instead of Type, see:
* https://github.com/harfbuzz/harfbuzz/pull/2875/commits/09836013995cab2b9f07577a179ad7b024130467 */
- operator hb_conditional<std::is_signed<Type>::value, signed, unsigned> () const { return v; }
+ operator typename std::conditional<std::is_signed<Type>::value, signed, unsigned>::type () const { return v; }
bool operator == (const IntType &o) const { return (Type) v == (Type) o.v; }
bool operator != (const IntType &o) const { return !(*this == o); }