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

602 commits

Author SHA1 Message Date
neargye
85e2c5be68 add subtype to enum_fuse 2023-05-21 21:27:39 +04:00
neargye
ed43fd5fa2 move iostream_operators to magic_enum_iostream 2023-05-21 20:55:52 +04:00
neargye
57d7e79530 clean-up 2023-05-21 17:38:39 +04:00
neargye
18602fd224 optimize compile-time: removed unnecessary array copying 2023-05-21 17:32:22 +04:00
neargye
9c710f6119 add more test 2023-05-21 17:09:30 +04:00
Penguin
f40a621528
switched to using idiomatic cmake set standard (#240) 2023-05-21 04:20:14 +04:00
neargye
427a47394f * Remove MAGIC_ENUM_ENABLE_NONASCII
* Optimize template instantiations
* Remove auto is_flags
* Change flags API
2023-05-21 04:08:07 +04:00
neargye
737ed4fc7f add fmt support 2023-05-19 19:49:36 +04:00
Ed Catmur
5367f5183c
Support gcc -fno-pretty-templates (#258)
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-fno-pretty-templates

The gcc option -fno-pretty-templates changes the __PRETTY_FUNCTION__ from e.g.
"auto n() [with E = E]" to "auto n<E>()" (more like MSVC).

Pass the entire __PRETTY_FUNCTION__ / __FUNCSIG__ to pretty_name(), and truncate it there, checking the last character if necessary to determine the format used.
2023-05-13 13:15:23 +04:00
talisein
d4fa0c3dd3
Add gcc 12 and NONASCII flags to ubuntu build matrix. (#262) 2023-05-13 12:49:24 +04:00
talisein
8111a0d17d
Move NONASCII tests to their own file (#261) 2023-05-13 03:44:45 +04:00
talisein
d6fef8b171
Add const to std::formatter method (#260) 2023-05-13 03:43:06 +04:00
Ezekiel Warren
48054f64ab
add bzlmod support (#254) 2023-04-26 20:16:08 +04:00
Valeri
fc88b4936a
meson: add options and tests (#255) 2023-04-24 23:36:25 +04:00
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