299 Commits

Author SHA1 Message Date
neargye 5018ef9677 v0.9.2 2023-06-10 15:30:32 +04:00
Jordan Rupprecht 8a26b3dc42 Re-enable Wenum-constexpr-conversion clang fix (#279) 2023-06-06 13:22:49 +04:00
neargye 27f5b9d925 clean-up 2023-06-05 15:18:56 +04:00
neargye 6e1978eea7 fix warn 2023-06-05 15:16:20 +04:00
neargye 3b4967b21e move all enum_flags_* func to enum_flags.hpp 2023-06-05 14:44:06 +04:00
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 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 abf48fc20e fix enum name in class 2023-05-30 12:54:30 +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
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
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 d6fef8b171 Add const to std::formatter method (#260) 2023-05-13 03:43:06 +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]: https://github.com/llvm/llvm-project/commit/8ff2d6af6906261567d8c10be62711ce899fb485

[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
Alexander 6527df91d2 Support R++ builtins for type/enumerator name (#238) 2023-02-01 18:24:12 +04:00
Bela Schaum 533c9509ef add constexpr containers (#187) 2023-01-17 18:59:37 +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
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 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
Alexander 1b1194bcd5 Remove redundant instantiation (#211) 2022-09-02 14:30:16 +04:00
Daniil Goncharov d26a7a2293 No hash (#208) 2022-08-17 21:38:30 +04:00
neargye b5116d078d add aliases test 2022-08-13 17:51:46 +04:00