Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxwa committed Mar 6, 2024
1 parent 972ea88 commit 0bb5674
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ struct first_applicable<T, I, Is...> : first_applicable<T, Is...> {};
template <template <class> class T, class... Is>
using first_applicable_t = typename first_applicable<T, Is...>::type;

template <int> struct is_constexpr_helper;
template <class Expr>
consteval bool is_constexpr(Expr)
{ return requires { typename is_constexpr_helper<(Expr{}(), 0)>; }; }
{ return requires { typename std::bool_constant<(Expr{}(), false)>; }; }

template <class T>
consteval bool has_copyability(constraint_level level) {
Expand Down Expand Up @@ -338,10 +337,7 @@ template <class F>
typename F::dispatch_types;
{ F::constraints } -> std::same_as<const proxiable_ptr_constraints&>;
typename F::reflection_type;
} &&
is_facade_constraints_well_formed<F>() &&
(std::is_void_v<typename F::reflection_type> ||
std::is_trivially_copyable_v<typename F::reflection_type>))
} && is_facade_constraints_well_formed<F>())
struct facade_traits<F> : facade_traits_impl<F, typename F::dispatch_types> {};

using ptr_prototype = void*[2];
Expand Down
4 changes: 2 additions & 2 deletions tests/proxy_traits_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ static_assert(!pro::facade<BadFacade_MissingReflectionType>);
struct BadFacade_BadReflectionType {
using dispatch_types = std::tuple<>;
static constexpr auto constraints = pro::relocatable_ptr_constraints;
using reflection_type = std::unique_ptr<int>;
using reflection_type = std::unique_ptr<int>; // Probably constexpr, unknown until the evaluation of proxiablility
};
static_assert(!pro::facade<BadFacade_BadReflectionType>);
static_assert(pro::facade<BadFacade_BadReflectionType>);

} // namespace

0 comments on commit 0bb5674

Please sign in to comment.