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

574 commits

Author SHA1 Message Date
Daniil Goncharov
9508c563da
add enum_flags_test and enum_flags_test_any functions for flags (#277)
Co-authored-by: Jon Petrissans <jon.petrissans@protonmail.com>
2023-06-05 14:10:02 +04:00
neargye
0b2c1cf072 MAGIC_ENUM_VS_2017_WORKAROUND 2023-06-05 14:09:38 +04:00
neargye
75cf5003f4 fix enum-name on vs2017 2023-06-05 13:50:45 +04:00
neargye
2274b77c80 fix enum_subtype deduction 2023-06-04 20:45:10 +04:00
neargye
1c94e914c2 fix #276 2023-06-02 11:50:02 +04:00
neargye
f2ddc4ba62 add more test 2023-06-02 11:24:25 +04:00
neargye
04ecb134ff fix char_type cast 2023-05-31 15:46:21 +04:00
neargye
67abcf483a v0.9.1 2023-05-31 14:58:31 +04:00
neargye
06598d1595 remove unnecessary func 2023-05-30 17:58:31 +04:00
neargye
e59f8736fe remove unnecessary template instantiations 2023-05-30 17:18:07 +04:00
neargye
6fe7ffbf35 fix enum name in namespace 2023-05-30 14:37:45 +04:00
neargye
6fec6f6386 add more test 2023-05-30 13:24:25 +04:00
neargye
abf48fc20e fix enum name in class 2023-05-30 12:54:30 +04:00
Tyler
930bcf0ba2
fixed meson build for the tests (#275) 2023-05-30 12:29:52 +04:00
Daniil Goncharov
6304edd7f6
update doc 2023-05-26 17:33:03 +04:00
Daniil Goncharov
8f6c9905fd
Enable wchar_t as string_view value_type (#272) 2023-05-24 19:05:20 +04:00
neargye
fba99305d2 v0.9.0 2023-05-24 13:51:51 +04:00
neargye
50adc0691e fix clang-format 2023-05-23 21:12:42 +04:00
Bela Schaum
dd2fb1b9a3
Fix https://github.com/Neargye/magic_enum/issues/234#issuecomment-1468134598 (#271) 2023-05-23 20:43:04 +04:00
Diogo Teles Sant'Anna
8f933fcfbd
Create Security Policy (#270) 2023-05-23 11:37:51 +04:00
Daniil Goncharov
629f7b09af
add support big range (#268)
* add support big range

* remove string_view from n()

* fix containers
2023-05-22 19:44:28 +04:00
neargye
4c54c094ea clean-up 2023-05-21 23:35:04 +04:00
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