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

360 commits

Author SHA1 Message Date
neargye
306b1d0704 add comparison predicate for enum_cast 2020-04-02 17:08:42 +05:00
Daniil Goncharov
a76480629c
Change contains_value to enum_contains (#31)
* change contains_value to enum_contains

* update test

* update doc
2020-03-13 18:10:09 +05:00
oficsu
aa24461613
Introduce contains_value()
* split enum_traits index

* add more proper way to check if enum contains certain value

* change description of contains_value() and add it in readme
2020-03-13 14:12:01 +05:00
neargye
94b133abd8 update copyright 2020-02-25 15:52:19 +05:00
neargye
cae43830a3 more friendly static checks 2020-02-14 15:09:11 +05:00
Neargye
2327f53634 v0.6.5 2020-01-31 14:13:11 +05:00
Neargye
59a9cddb6d clean-up 2020-01-31 14:08:38 +05:00
Neargye
e3dd165a4a add compile check at enum_name 2020-01-25 23:51:50 +05:00
neargye
a576c077be fix code style 2020-01-15 15:42:42 +05:00
neargye
f900f4e01d v0.6.4 2019-12-30 17:17:18 +05:00
Neargye
1d7f773bfa explicit ctr 2019-12-13 11:22:11 +05:00
Neargye
70cf23a7e3 suppress specific warnings 2019-12-13 11:19:21 +05:00
neargye
3393b85145 clean-up 2019-11-23 19:40:30 +05:00
neargye
3b2ebf7e55 add enum concept 2019-11-18 13:35:59 +05:00
neargye
e325a70663 fix macro check support 2019-11-18 13:35:45 +05:00
Alexander Karatarakis
f951f3f04e Fix typo in version (#20) 2019-10-24 13:30:10 +03:00
neargye
10d09b1c99 add cstdint because used std::int*_t 2019-10-18 19:21:47 +05:00
neargye
64856beffb v0.6.3 2019-10-18 13:33:06 +05:00
neargye
5a33daa766 update enum_traits 2019-10-17 13:18:37 +05:00
neargye
d022583a1a clean-up cast, size check 2019-10-16 14:11:15 +05:00
neargye
6c9c498faa clean-up mixed_sign_less 2019-10-14 17:29:35 +05:00
neargye
5873f123f3 clean-up 2019-10-14 13:54:17 +05:00
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