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

288 commits

Author SHA1 Message Date
neargye
4066fa35e5 get values on all reflected_range to avoid additional work 2019-10-14 13:10:15 +05:00
Alexander Karatarakis
db4c55c36a Change the way range_min()/max() is calculated (#19)
This was previously done via parameter expansion. The expanded form
looks like this:
A(128) && A(127) && ... && A(X) && ... && A(0)

where A(X) is the actual range_max which is crafted to return 'false'.
Static analysis detects that expressions after A(X) are
dead code due to short-circuiting.

The new implementation uses a simple loop to find the extrema,
similarly to the loop in detail::values().
Furthermore, it uses only one parameter expansion (for reflected_set_v),
as opposed to two (one for range_min and one for range_max).
2019-10-14 10:44:42 +03:00
Alexander Karatarakis
0f36cd5b0f Introduce mixed_sign_less()/min()/max() (#18)
Previously, there was mixed sign comparison:
```
reflected_min_v = -120 > 0U ? -120 : 0
```
which returns -120 because the condition is true, since the
compiler casts the signed value to unsigned, leading to a huge value.
This caused the following values as result:

```
reflected_min_v == -120
min_v = -1
static_cast<U>(min_v) = 18446744073709551615
```

The last one is used in magic_enum::enum_index().
2019-10-14 10:44:09 +03:00
neargye
1f3ea64407 v0.6.2 2019-10-08 13:20:14 +05:00
neargye
00bd8528ce update doc
fix MAGIC_ENUM_NO_CHECK_SUPPORT
2019-10-04 13:58:08 +05:00
neargye
1f61e72c26 fix type cast 2019-10-03 17:33:18 +05:00
neargye
77314d254d clean-up 2019-10-03 17:08:11 +05:00
neargye
0b262f7cc8 fix cvref 2019-10-03 14:50:09 +05:00
Alexander Karatarakis
3f0aad9f74 Fix regression of enum_cast<>() when used with refs (EnumT& vs EnumT) (#16) 2019-10-03 12:02:39 +05:00
neargye
cbbb6dd8f1 add comment to MAGIC_ENUM_SUPPORTED 2019-10-02 17:52:04 +05:00
neargye
105c8f067e remove is_fixed_enum
non stable and useless
2019-10-02 17:06:36 +05:00
neargye
c947afdbae change check support compiler 2019-10-02 15:28:53 +05:00
neargye
75c9d9bce5 caching entries 2019-10-01 16:58:55 +05:00
neargye
2c0b00a7ed add error if count < 0, fix #15 2019-10-01 16:58:35 +05:00
neargye
92dfab4ac4 improve enum_value for dense enums 2019-09-30 19:08:29 +05:00
neargye
77918a74c5 fix build on gcc<9 2019-09-30 17:17:50 +05:00
neargye
52f36fc5a0 removed definition that used only once 2019-09-29 17:47:54 +05:00
neargye
8eb87a9a88 v0.6.1 2019-09-29 16:31:58 +05:00
neargye
370a1d5236 improvement
* SFINAE-friendly
* overhead reduction
* add enum_index
* add enum_traits
* less bin size
2019-09-29 16:22:09 +05:00
neargye
455e4dcf9b strengthened noexcept 2019-09-09 19:38:30 +05:00
neargye
3edfd58e59 clean-up naming 2019-09-03 17:53:26 +05:00
neargye
c0ae150a26 add macro to no check support 2019-08-29 18:52:20 +05:00
neargye
317029850a fix type cast and clean-up 2019-08-29 18:52:16 +05:00
neargye
c9337182f4 fix is_magic_enum_supported 2019-08-27 20:30:12 +05:00
neargye
a9a8892026 fix static_assert msg 2019-08-27 18:14:02 +05:00
neargye
e30e8d81bd less bin size, improving check supported compiler, clean-up
thanks @rollbear
2019-08-27 16:50:23 +05:00
neargye
2e61a86b2f improve name_impl 2019-08-25 17:02:00 +05:00
neargye
7707d08ff5 error if unsupported compiler 2019-08-24 14:16:24 +05:00
neargye
7c7cdc906b fix bitwise_operators 2019-08-20 00:01:53 +05:00
neargye
2b76827698 clean-up bitwise_operators 2019-08-19 21:58:52 +05:00
neargye
885b202dc6 remove optional auto 2019-08-19 21:53:06 +05:00
neargye
777792339c clean-up ostream operator 2019-08-19 20:44:08 +05:00
terik23
8187796f3d v0.6.0 2019-07-27 17:56:53 +05:00
terik23
c3f158324a clean-up 2019-07-27 17:52:29 +05:00
terik23
172c685547 improve name_impl, ostream_operators 2019-07-25 00:37:59 +05:00
neargye
6f3723746f improving compile times 2019-07-24 18:48:23 +05:00
neargye
9a700b545d add bitwise_operators 2019-07-24 18:47:36 +05:00
neargye
6a977cbe9a refactoring 2019-07-23 19:54:41 +05:00
terik23
ef5ab60f37 improving 2019-07-14 21:51:17 +05:00
Won Seong-Yeon
58c0b9ac59 Fixing Syntax Error caused by "Windows.h" (#7)
OMG! Windows.h define wack macro...max() min()!
2019-07-13 19:11:39 +05:00
neargye
6fb880356c add enum traits 2019-07-11 20:27:14 +05:00
neargye
251d948438 fix formatting 2019-07-11 20:27:11 +05:00
terik23
b8f7722a4f fix #6 2019-07-05 02:59:14 +05:00
neargye
f1e781fe52 update include guard 2019-05-28 17:53:40 +05:00
neargye
b7f84490be v0.5.0 2019-05-02 20:02:27 +05:00
neargye
34fb3ba22a add enum_name for static storage enum variable 2019-05-02 19:40:51 +05:00
neargye
b79706d64d change include guard 2019-05-01 19:47:26 +05:00
terik23
8f095f8c22 enum_integer_value -> enum_integer 2019-04-30 11:42:31 +05:00
terik23
09373fbd6a wip new version 2019-04-30 10:31:34 +05:00
neargye
d3027d904f wip 2019-04-29 20:21:12 +05:00