Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use __is_convertible builtin in ustl when available #293

Merged
merged 1 commit into from
May 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion common/include/ustl/uttraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,16 @@ UNARY_TRAIT_DEFB (has_trivial_copy_assign, __has_trivial_assign(T));
template <typename T, typename U> struct is_same : public false_type {};
template <typename T> struct is_same<T,T> : public true_type {};

#if __clang__ // clang has __is_convertible builtin
#if defined __has_builtin
#if __has_builtin (__is_convertible)
#define USTL_BUILTIN__is_convertible 1
#endif
#endif
#ifndef USTL_BUILTIN__is_convertible
#define USTL_BUILTIN__is_convertible 0
#endif

#if __clang__ || USTL_BUILTIN__is_convertible == 1 // clang, gcc >= 13 have __is_convertible builtin

template <typename F, typename T>
struct is_convertible : public integral_constant<bool, __is_convertible(F, T)> {};
Expand Down