Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kelbon committed Nov 4, 2023
1 parent 4b056be commit 4c4b5ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
34 changes: 7 additions & 27 deletions include/anyany/anyany.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1172,35 +1172,15 @@ struct basic_any : construct_interface<basic_any<Alloc, SooS, Methods...>, Metho
using base_any_type = basic_any;
using methods_list = ::aa::type_list<Methods...>;

private:
template <typename... Methods1>
struct types {
using ptr = poly_ptr<Methods1...>;
using const_ptr = const_poly_ptr<Methods1...>;
using ref = poly_ref<Methods1...>;
using const_ref = const_poly_ref<Methods1...>;
using stateful_ref = stateful::ref<Methods1...>;
using stateful_cref = stateful::cref<Methods1...>;
using interface = runtime_concept<Methods1...>;
};
// remove 'destroy' Method only if it was automatically added(not provided by user/created by 'materialize')
template <typename... Methods1>
struct remove_utility_methods : types<Methods...> {};
template <typename... Methods1>
struct remove_utility_methods<destroy, Methods1...> : types<Methods1...> {};

using purified = remove_utility_methods<Methods...>;

public:
using ptr = typename purified::ptr;
using ref = typename purified::ref;
using cptr = typename purified::const_ptr;
using cref = typename purified::const_ref;
using ptr = poly_ptr<Methods...>;
using ref = poly_ref<Methods...>;
using cptr = const_poly_ptr<Methods...>;
using cref = const_poly_ref<Methods...>;
using const_ptr = cptr;
using const_ref = cref;
using stateful_ref = typename purified::stateful_ref;
using stateful_cref = typename purified::stateful_cref;
using interface = typename purified::interface;
using stateful_ref = stateful::ref<Methods...>;
using stateful_cref = stateful::cref<Methods...>;
using interface = runtime_concept<Methods...>;

// aliases without 'destroy' for usage like any_with<a, b, c>::ref
// but operator& return with 'destroy' method(implicitly converitble anyway)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_anyany.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ void anyany_interface_alias_tests() {
aa::basic_any<aa::default_allocator, aa::default_any_soos, aa::destroy,
aa::destroy, aa::type_info, aa::destroy, aa::type_info>>);
static_assert(std::is_same_v<aa::any_with<a, b, c>::ref,
aa::poly_ref<aa::destroy, aa::type_info, aa::destroy, aa::type_info>>);
aa::poly_ref<aa::destroy, aa::destroy, aa::type_info, aa::destroy, aa::type_info>>);
#if __cplusplus >= 202002L
static_assert(aa::compound_method<a>);
static_assert(aa::compound_method<b>);
Expand Down

0 comments on commit 4c4b5ce

Please sign in to comment.