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

add option to disable concepts #60

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion include/anyany/anyany.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ using args_list = typename method_traits<Method>::args;
template <typename Method>
constexpr inline bool is_const_method_v = method_traits<Method>::is_const;

#ifdef AA_HAS_CPP20
// disabling concepts may be usefull for forward declarations
#if !defined(ANYANY_DISABLE_CONCEPTS) && defined(AA_HAS_CPP20)

// pseudomethod is just a value, which is stored in vtable
template <typename T>
Expand Down
5 changes: 3 additions & 2 deletions tests/test_anyany.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <random>
#include <unordered_set>
#define ANYANY_ASSUME_NO_DLLS
#define ANYANY_DISABLE_CONCEPTS
#include <anyany/anyany.hpp>
#include <anyany/anyany_macro.hpp>

Expand Down Expand Up @@ -982,7 +983,7 @@ void anyany_interface_alias_tests() {
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>>);
#if __cplusplus >= 202002L
#if !defined(ANYANY_DISABLE_CONCEPTS) && __cplusplus >= 202002L
static_assert(aa::compound_method<a>);
static_assert(aa::compound_method<b>);
static_assert(aa::compound_method<c>);
Expand All @@ -1006,7 +1007,7 @@ void anyany_concepts_test() {
anyany_interface_alias_tests<aa::cptr>();
anyany_interface_alias_tests<aa::stateful::ref>();
anyany_interface_alias_tests<aa::stateful::cref>();
#if __cplusplus >= 202002L
#if !defined(ANYANY_DISABLE_CONCEPTS) && __cplusplus >= 202002L
aa::any_with<test_pseudomethod, test_pseudomethod> compiles;
(void)compiles;
static_assert(aa::method<empty_value_pseudomethod<int>>);
Expand Down
Loading