[meta] Rewrite hb_is_cr_converitble
This commit is contained in:
parent
ceda1f03b7
commit
69d9114b53
|
@ -116,18 +116,6 @@ template <typename T> using hb_remove_pointer = typename hb_match_pointer<T>::ty
|
||||||
/* TODO Add feature-parity to std::decay. */
|
/* TODO Add feature-parity to std::decay. */
|
||||||
template <typename T> using hb_decay = hb_remove_const<hb_remove_reference<T>>;
|
template <typename T> using hb_decay = hb_remove_const<hb_remove_reference<T>>;
|
||||||
|
|
||||||
#define hb_is_cr_convertible(From, To) \
|
|
||||||
( \
|
|
||||||
hb_is_same (hb_decay<From>, hb_decay<To>) && \
|
|
||||||
( \
|
|
||||||
hb_is_const (From) <= hb_is_const (To) && \
|
|
||||||
hb_is_reference (From) >= hb_is_reference (To) \
|
|
||||||
) || ( \
|
|
||||||
hb_is_const (To) && hb_is_reference (To) \
|
|
||||||
) \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<bool B, class T, class F>
|
template<bool B, class T, class F>
|
||||||
struct _hb_conditional { typedef T type; };
|
struct _hb_conditional { typedef T type; };
|
||||||
|
@ -159,6 +147,16 @@ struct hb_is_convertible
|
||||||
};
|
};
|
||||||
#define hb_is_convertible(From,To) hb_is_convertible<From, To>::value
|
#define hb_is_convertible(From,To) hb_is_convertible<From, To>::value
|
||||||
|
|
||||||
|
template <typename From, typename To>
|
||||||
|
struct hb_is_cr_convertible
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static constexpr bool value =
|
||||||
|
hb_is_same (hb_decay<From>, hb_decay<To>) &&
|
||||||
|
(!hb_is_const (From) || hb_is_const (To)) &&
|
||||||
|
(!hb_is_reference (To) || hb_is_const (To) || hb_is_reference (To));
|
||||||
|
};
|
||||||
|
#define hb_is_cr_convertible(From,To) hb_is_cr_convertible<From, To>::value
|
||||||
|
|
||||||
/* std::move and std::forward */
|
/* std::move and std::forward */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue