1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-09 23:34:23 +00:00
Commit graph

438 commits

Author SHA1 Message Date
ts826848
95c71dab42
Include <functional> (#252)
This is necessary to avoid compilation errors using recent libc++
versions with C++23 due to libc++ taking steps to remove transitive
includes in newer C++ versions [0].

For a more concrete example, this program builds using Clang 16.0.0 and
C++20, but fails to build with C++23:

    #include <magic_enum.hpp>
    enum class ec { RED };
    template <>
    constexpr auto magic_enum::customize::enum_name(ec val) noexcept
        -> magic_enum::customize::customize_t {
      switch (val) {
      case ec::RED: return "Red";
      };
      return invalid_tag;
    }

The compiler hits the "too many errors" threshold when building with
C++23, but I believe this is due to compiling failing to recover after
the first error. The error message starts with:

    include % /usr/local/opt/llvm/bin/clang++ -std=c++2b -c test.cpp
    In file included from test.cpp:1:
    ./magic_enum.hpp:324:61: error: no member named 'equal_to' in namespace 'std'
      return std::is_same_v<std::decay_t<BinaryPredicate>, std::equal_to<string_view::value_type>> ||
                                                           ~~~~~^
    ./magic_enum.hpp:324:93: error: expected '(' for function-style cast or type construction
      return std::is_same_v<std::decay_t<BinaryPredicate>, std::equal_to<string_view::value_type>> ||
                                                                         ~~~~~~~~~~~~~~~~~~~~~~~^
    ./magic_enum.hpp:324:96: error: expected expression
      return std::is_same_v<std::decay_t<BinaryPredicate>, std::equal_to<string_view::value_type>> ||
                                                                                                   ^

std::equal_to is defined in <functional>, but <functional> is not
directly included by magic_enum.hpp. <string> [1] and <string_view> [2]
both include <functional> for C++20 and earlier, but they no longer
include <functional> in C++23 and later, so a definition for
std::equal_to is no longer visible, leading to the above error.

Directly including <functional> fixes this error, but I'm not sure there
aren't similar errors.

[0]: 8ff2d6af69

[1]: https://github.com/llvm/llvm-project/blob/llvmorg-16.0.0/libcxx/include/string#L4625

[2]: https://github.com/llvm/llvm-project/blob/llvmorg-16.0.0/libcxx/include/string_view#L1027

Co-authored-by: Alex Wang <ts826848@gmail.com>
2023-03-29 16:03:50 +04:00
Diogo Teles Sant'Anna
73e91dc28c
ci: set minimal permissions on workflows (#248) 2023-03-08 01:57:54 +04:00
KOLANICH
6542403248
Fix forgotten replacement in CPack packaging script (#243) 2023-02-16 12:04:09 +04:00
Alexander
6527df91d2
Support R++ builtins for type/enumerator name (#238) 2023-02-01 18:24:12 +04:00
Dirk Stolle
769506a8e6
fix Clang 16 build in GitHub Actions (#237) 2023-01-31 21:56:59 +04:00
Dirk Stolle
2d9fb26c46
Update actions/checkout in GitHub Actions workflows to v3 (#236) 2023-01-31 17:36:01 +04:00
Bela Schaum
533c9509ef
add constexpr containers (#187) 2023-01-17 18:59:37 +04:00
KOLANICH
2a7658d084
Implemented packaging using CPack. (#202) 2023-01-17 18:52:59 +04:00
neargye
d01a4f90a6 fix pretty_name with ENABLE_NONASCII 2022-12-20 13:32:25 +04:00
Anton Shalgachev
d5e8530191
simplify pretty_name to speed up constexpr evaluation (#227) 2022-12-20 13:24:01 +04:00
neargye
e1a68e9dd3 v0.8.2 2022-12-09 15:52:24 +04:00
neargye
b625fe721c ENABLE_NONASCII depends only on settings 2022-11-28 14:37:24 +02:00
ilobilo
20cac97b53
add missing magic_enum namespace (#223) 2022-11-22 11:37:06 +02:00
Daniil Goncharov
aa1f2869f4
compile-time optimization 2022-11-09 22:00:09 +04:00
neargye
684718c58b clean-up 2022-11-09 00:00:34 +04:00
neargye
612033ab5d add suport enum_switch without defined MAGIC_ENUM_ENABLE_HASH 2022-11-08 20:24:27 +04:00
neargye
c588771875 update doc 2022-11-08 13:02:11 +04:00
neargye
3d64c1b5bb clean-up 2022-11-07 23:26:44 +04:00
neargye
f29ad727ba enum_cast optimization 2022-11-07 23:14:24 +04:00
neargye
099abc330a clean-up 2022-11-07 21:30:23 +04:00
neargye
6fca52c1e7 compile-time optimization 2022-11-07 21:10:41 +04:00
neargye
8bd403f888 fix #216, fix #199 2022-11-07 21:00:16 +04:00
ilobilo
596f00c0db
make streams and exceptions optional (#218)
* magic_enum: make streams optional
this commit adds support to disable streams
with macro MAGIC_ENUM_NO_STREAMS

* magic_enum_format: add support to disable exceptions
this commit adds support to disable exceptions
with macro MAGIC_ENUM_NO_EXCEPTIONS
2022-11-04 23:46:37 +04:00
neargye
159a35006d fix #215 2022-10-11 19:01:04 +04:00
Alexander
1b1194bcd5
Remove redundant instantiation (#211) 2022-09-02 14:30:16 +04:00
Nick Grebnev
1a57977ea3
Typo fixed (#210) 2022-08-20 17:57:30 +04:00
Daniil Goncharov
d26a7a2293
No hash (#208) 2022-08-17 21:38:30 +04:00
Daniil Goncharov
8f9f4afee7
Exercise Bazel build in CI (#206) 2022-08-14 16:43:31 +04:00
neargye
0fec11eda3 fix build 2022-08-13 18:12:55 +04:00
neargye
cd1ec187e6 fix #157 2022-08-13 18:09:42 +04:00
neargye
b5116d078d add aliases test 2022-08-13 17:51:46 +04:00
neargye
e6ce44337a hash_v inline 2022-08-13 17:45:42 +04:00
Daniil Goncharov
f4ebb4f185
update ci (#205) 2022-08-10 14:53:38 +04:00
neargye
e0f8f14724 fix build clang trunk 2022-08-09 16:45:08 +04:00
neargye
51d20f4d18 fix clang llvm-project#50055(reviews.llvm.org/D131307) 2022-08-09 16:38:07 +04:00
neargye
4211ff944b ignored "-Wenum-constexpr-conversion" 2022-08-09 15:47:56 +04:00
neargye
4f7c7577b5 clean-up 2022-08-08 22:23:15 +04:00
neargye
13ba445e9c clean-up 2022-08-08 21:07:05 +04:00
neargye
95641a8f78 fix clang llvm-project#50055(reviews.llvm.org/D130058) 2022-08-08 21:00:17 +04:00
neargye
f5d6f707a9 try fix IntelliSence 2022-08-08 14:15:53 +04:00
neargye
0dfa61e757 fix warning 2022-08-05 18:24:02 +04:00
neargye
35a3c7c9da std::size_t -> std::uint16_t 2022-08-05 15:36:37 +04:00
neargye
43a9272f45 v0.8.1 2022-08-04 16:12:39 +04:00
neargye
4802f793bb clean-up 2022-06-28 14:57:34 +04:00
neargye
b45b470bea update doc 2022-06-28 14:57:02 +04:00
Bela Schaum
dd80219653
Magic enum format in a separated header file (#185) 2022-06-28 14:45:47 +04:00
neargye
c7cf02053b fix #190, #192 2022-06-28 14:44:34 +04:00
Bård Sigurd Møller
6956c56033
Fix compilation error, when including magic_enum after windows.h (#189) 2022-05-28 22:55:51 +04:00
neargye
87190b811c v0.8.0 2022-05-10 23:37:52 +04:00
neargye
c59aec8b1c fuse separated into separate header 2022-05-10 21:22:57 +04:00