Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kelbon committed Jan 13, 2025
1 parent 3f4ebb0 commit 5ec3183
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
28 changes: 21 additions & 7 deletions include/anyany/anyany.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,17 @@ template <typename X, anyany_simple_method_concept... Methods>
struct exist_for {
private:
template <typename T, typename Method>
static auto check_fn(int) -> decltype(Method::template do_invoke<T>, std::true_type{});
static auto check_fn(int) -> decltype(Method::template do_invoke<T>, std::true_type{}) {
throw;
}
template <typename T, typename Method> // for pseudomethods, must be consteval fn
static auto check_fn(bool) -> decltype(Method{}.template do_value<T>(), std::true_type{});
static auto check_fn(bool) -> decltype(Method{}.template do_value<T>(), std::true_type{}) {
throw;
}
template <typename, typename>
static auto check_fn(...) -> std::false_type;
static auto check_fn(...) -> std::false_type {
throw;
}

public:
static constexpr inline bool value = (decltype(check_fn<std::decay_t<X>, Methods>(0))::value && ...);
Expand Down Expand Up @@ -316,9 +322,13 @@ struct copy_method {

namespace noexport {

auto get_any_copy_method(type_list<>) -> void;
auto get_any_copy_method(type_list<>) -> void {
throw;
}
template <typename A, size_t N, typename... Tail>
auto get_any_copy_method(type_list<copy_method<A, N>, Tail...>) -> copy_method<A, N>;
auto get_any_copy_method(type_list<copy_method<A, N>, Tail...>) -> copy_method<A, N> {
throw;
}
template <typename Head, typename... Tail>
auto get_any_copy_method(type_list<Head, Tail...>) {
return get_any_copy_method(type_list<Tail...>{});
Expand Down Expand Up @@ -514,9 +524,13 @@ namespace noexport {
// searches for ::type,
// if no ::type, then Plugin itself used
template <typename Plugin>
auto select_plugin(int) -> typename Plugin::type;
auto select_plugin(int) -> typename Plugin::type {
throw;
}
template <typename Plugin>
auto select_plugin(...) -> Plugin;
auto select_plugin(...) -> Plugin {
throw;
}

} // namespace noexport

Expand Down
20 changes: 15 additions & 5 deletions include/anyany/noexport/anyany_details.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ template <typename... Ts>
struct AA_MSVC_EBO inheritor_of : Ts... {};

template <typename... Results>
auto inherit_without_duplicates(type_list<>, type_list<Results...>) -> inheritor_of<Results...>;
auto inherit_without_duplicates(type_list<>, type_list<Results...>) -> inheritor_of<Results...> {
throw;
}

template <typename Head, typename... Tail, typename... Results>
auto inherit_without_duplicates(type_list<Head, Tail...>, type_list<Results...> l) {
Expand All @@ -212,12 +214,18 @@ struct type_identity {
};

template <typename Method>
auto get_method_signature(int) -> type_identity<typename Method::signature_type>;
auto get_method_signature(int) -> type_identity<typename Method::signature_type> {
throw;
}
template <typename Method>
auto get_method_signature(bool)
-> type_identity<std::remove_pointer_t<decltype(&Method::template do_invoke<erased_self_t>)>>;
-> type_identity<std::remove_pointer_t<decltype(&Method::template do_invoke<erased_self_t>)>> {
throw;
}
template <typename Method>
auto get_method_signature(...) -> type_identity<typename Method::value_type>;
auto get_method_signature(...) -> type_identity<typename Method::value_type> {
throw;
}

template <typename Method>
using signature_t = typename decltype(get_method_signature<Method>(0))::type;
Expand Down Expand Up @@ -327,7 +335,9 @@ constexpr bool contains_second_layer_list(aa::type_list<Ts...>) {
}

template <template <typename...> typename Template, typename... Types>
auto insert_types(aa::type_list<Types...>) -> Template<Types...>;
auto insert_types(aa::type_list<Types...>) -> Template<Types...> {
throw;
}

template <typename, typename T>
using enable_if_impl = T;
Expand Down

0 comments on commit 5ec3183

Please sign in to comment.