struct hb_is_iterator_of
{
template <typename Item2 = Item>
- static hb_true_t impl (hb_priority<2>, hb_iter_t<Iter, hb_type_identity<Item2>> *);
- static hb_false_t impl (hb_priority<0>, const void *);
+ static hb_true_type impl (hb_priority<2>, hb_iter_t<Iter, hb_type_identity<Item2>> *);
+ static hb_false_type impl (hb_priority<0>, const void *);
public:
static constexpr bool value = decltype (impl (hb_prioritize, hb_declval (Iter*)))::value;
private:
template <typename U>
- static auto impl (hb_priority<1>) -> decltype (hb_declval (U).iter (), hb_true_t ());
+ static auto impl (hb_priority<1>) -> decltype (hb_declval (U).iter (), hb_true_type ());
template <typename>
- static hb_false_t impl (hb_priority<0>);
+ static hb_false_type impl (hb_priority<0>);
public:
static constexpr bool value = decltype (impl<T> (hb_prioritize))::value;
private:
template <typename Iter2 = Iter,
hb_enable_if (hb_is_convertible (typename Iter2::item_t, const Item &))>
- static hb_true_t impl (hb_priority<2>);
+ static hb_true_type impl (hb_priority<2>);
template <typename Iter2 = Iter>
- static auto impl (hb_priority<1>) -> decltype (hb_declval (Iter2) >> hb_declval (Item &), hb_true_t ());
- static hb_false_t impl (hb_priority<0>);
+ static auto impl (hb_priority<1>) -> decltype (hb_declval (Iter2) >> hb_declval (Item &), hb_true_type ());
+ static hb_false_type impl (hb_priority<0>);
public:
static constexpr bool value = decltype (impl (hb_prioritize))::value;
private:
template <typename Iter2 = Iter,
hb_enable_if (hb_is_convertible (typename Iter2::item_t, Item &))>
- static hb_true_t impl (hb_priority<2>);
+ static hb_true_type impl (hb_priority<2>);
template <typename Iter2 = Iter>
- static auto impl (hb_priority<1>) -> decltype (hb_declval (Iter2) << hb_declval (Item), hb_true_t ());
- static hb_false_t impl (hb_priority<0>);
+ static auto impl (hb_priority<1>) -> decltype (hb_declval (Iter2) << hb_declval (Item), hb_true_type ());
+ static hb_false_type impl (hb_priority<0>);
public:
static constexpr bool value = decltype (impl (hb_prioritize))::value;
template<typename Head, typename... Ts> struct _hb_head_tt { typedef Head type; };
template<typename... Ts> using hb_head_tt = typename _hb_head_tt<Ts...>::type;
-/* Bool! For when we need to evaluate type-dependent expressions
- * in a template argument. */
-template <bool b> struct hb_bool_constant { static constexpr bool value = b; };
-typedef hb_bool_constant<true> hb_true_t;
-typedef hb_bool_constant<false> hb_false_t;
+template <typename T, T v> struct hb_integral_constant { static constexpr T value = v; };
+template <bool b> using hb_bool_constant = hb_integral_constant<bool, b>;
+using hb_true_type = hb_bool_constant<true>;
+using hb_false_type = hb_bool_constant<false>;
/* Basic type SFINAE. */
/* Concepts/Requires alias: */
#define hb_requires(Cond) hb_enable_if((Cond))
-template <typename T, typename T2> struct hb_is_same : hb_false_t {};
-template <typename T> struct hb_is_same<T, T> : hb_true_t {};
+template <typename T, typename T2> struct hb_is_same : hb_false_type {};
+template <typename T> struct hb_is_same<T, T> : hb_true_type {};
#define hb_is_same(T, T2) hb_is_same<T, T2>::value
/* Function overloading SFINAE and priority. */
static constexpr bool either_void = from_void || to_void;
static constexpr bool both_void = from_void && to_void;
- static hb_true_t impl2 (hb_conditional<to_void, int, To>);
+ static hb_true_type impl2 (hb_conditional<to_void, int, To>);
template <typename T>
static auto impl (hb_priority<1>) -> decltype (impl2 (hb_declval (T)));
template <typename T>
- static hb_false_t impl (hb_priority<0>);
+ static hb_false_type impl (hb_priority<0>);
public:
static constexpr bool value = both_void ||
(!either_void &&
template <typename T>
struct hb_null_size
-{ enum { value = _hb_null_size<T, hb_true_t>::value }; };
+{ enum { value = _hb_null_size<T, hb_true_type>::value }; };
#define hb_null_size(T) hb_null_size<T>::value
/* These doesn't belong here, but since is copy/paste from above, put it here. */
template <typename T>
struct hb_static_size
-{ enum { value = _hb_static_size<T, hb_true_t>::value }; };
+{ enum { value = _hb_static_size<T, hb_true_type>::value }; };
#define hb_static_size(T) hb_static_size<T>::value