Skip to content

Commit

Permalink
fix: Fix Overloaded error for C++ 11
Browse files Browse the repository at this point in the history
  • Loading branch information
cwahn committed Mar 7, 2024
1 parent fe7364a commit b0e5879
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 9 additions & 2 deletions include/efp/enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,21 @@ namespace detail {
template<typename... Fs>
struct Overloaded;

#if __cplusplus >= 201402L
template<>
struct Overloaded<> {
#if __cplusplus >= 201402L
// Better error message without extra compilation cost is only available in >= C++14
template<typename... Alts, EnableIf<True::value, int> = 0>
auto operator()(BadParam, int _ = 0, Alts&&...) const {}
#endif
};
#else
template<class F>
struct Overloaded<F>: F {
using F::operator();

Overloaded(const F& f) : F {f} {}
};
#endif

template<class F, class... Fs>
struct Overloaded<F, Fs...>: F, Overloaded<Fs...> {
Expand Down
1 change: 0 additions & 1 deletion test/efp/cyclic_test copy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "efp.hpp"


using namespace efp;

TEST_CASE("Vcb Rule of 5", "Vcb") {
Expand Down

0 comments on commit b0e5879

Please sign in to comment.