Daniil Goncharov
b0c0e02bdc
add compile time enum_index ( #159 )
2022-03-09 10:07:09 +02:00
Pavel I. Kryukov
9d1cf196cf
Make enum_fuse typesafe ( fixes #143 ) ( #145 )
2022-03-08 10:38:19 +02:00
Bela Schaum
9268bb3042
Case insensivity based on #112 ( #139 )
2022-02-18 23:31:36 +02:00
neargye
756b139368
remove throw from enum_fuse
2022-02-16 19:01:14 +02:00
neargye
63ff515163
clean-up
2022-02-10 20:17:44 +02:00
Pavel I. Kryukov
1f8e29b140
Add enum fusing function ( #127 )
2022-02-10 19:58:59 +02:00
Daniil Goncharov
aecf0db795
New enum-flags API ( #120 )
2022-01-08 17:30:44 +02:00
neargye
6a1db3b8b6
add tests
2022-01-04 22:00:03 +02:00
neargye
c7a0c83ed4
constexpr_for not work on vs2017
2021-10-09 02:40:44 +03:00
neargye
018673a0a4
add tests constexpr_for
2021-10-09 02:22:59 +03:00
Komachin
38f86e4d09
Added support for non-ASCII characters (UNIX/Linux) ( #95 )
2021-08-09 17:44:30 +03:00
Alexander Karatarakis
41c916432b
Fix underflow in out of range check ( #88 )
...
* Special case bool in cmp_less to avoid msvc's warnings
* Fix underflow in out of range check
The previous fix addressed bool but it seems that was not the heart
of the issue.
The problem is that (lhs - 1) can underflow.
Another example of the check trigger when it shouldn't is:
uint8_t with min_value set to 0 and a value of uint8_t::max
lhs-1 would underflow and find max (see added test).
The issue happens when lhs == rhs. To avoid that situation: flip the if-else!
`cmp_less(rhs, lhs)`means that rhs is strictly less than lhs, so
the check will not trigger when lhs == rhs.
Also, cleanup the bool special-case, as it is no longer necessary.
Note: for the bug to manifest, it is important that the min
of the enums is customized to be 0, so corresponding enum_range
specializations need to be present in the regression tests.
2021-06-25 15:00:54 +03:00
neargye
b927151677
update tests
2021-06-24 17:52:04 +03:00
neargye
739942ab7d
fix enums with underlying type bool
2021-06-24 11:48:37 +03:00
Gregor Jasny
c1e7c1475a
chore: update catch2 to 2.13.4 for Apple Silicon support ( #75 )
2021-02-22 18:10:47 +02:00
neargye
0810148bae
update copyring
2021-01-23 07:47:01 +02:00
Daniil Goncharov
690486e7f2
improve customize
2020-09-07 12:55:59 +03:00
neargye
02f2249239
clean-up
2020-08-16 17:43:22 +05:00
neargye
9c40cae91a
add enum-flags test
2020-08-16 14:58:48 +05:00
neargye
b6743e4a26
workaround enum_type_name
2020-08-16 12:10:22 +05:00
neargye
d73a985f52
add MAGIC_ENUM_SUPPORTED_ALIASES
2020-08-15 23:56:54 +05:00
neargye
8f31ad7cfa
wip
2020-08-15 19:52:37 +05:00
neargye
d2904860b8
wip
2020-07-04 15:13:48 +05:00
neargye
06cb3163f1
update ci
2020-07-02 17:39:08 +05:00
Daniil Goncharov
2b9f24fd2c
remove enum_traits ( #38 )
2020-05-24 16:11:08 +05:00
neargye
dab56da58c
update test
2020-05-11 15:30:20 +05:00
neargye
66d04cbe25
add more test
2020-05-11 14:30:33 +05:00
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
oficsu
1e6c9a5a5a
replace C-style cast with static_cast
2020-03-12 11:28:09 +05:00
neargye
94b133abd8
update copyright
2020-02-25 15:52:19 +05:00
neargye
f42605bbf1
update doc
2020-02-14 18:04:15 +05:00
Neargye
e3dd165a4a
add compile check at enum_name
2020-01-25 23:51:50 +05:00
neargye
00f46ae79c
fix test
2019-10-14 21:10:50 +05:00
neargye
a36721d6c7
clang 5 linker fail: undefined reference to `magic_enum::enum_range<number>::min/max'
2019-10-14 19:45:03 +05:00
neargye
3804a9d3b2
update test
2019-10-14 17:55:45 +05:00
neargye
851e7f1a4e
clean-up test
2019-10-14 17:47:36 +05:00
neargye
6b95773b05
clean-up tests
2019-10-14 13:03:28 +05: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
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
105c8f067e
remove is_fixed_enum
...
non stable and useless
2019-10-02 17:06:36 +05:00
neargye
2f9400bcf3
wow, msvc not follow standard
2019-09-29 17:50:05 +05:00
neargye
2541180874
update test
2019-09-29 16:22:47 +05:00
neargye
c9337182f4
fix is_magic_enum_supported
2019-08-27 20:30:12 +05:00
neargye
22167885d7
update tests
2019-08-24 20:09:50 +05:00
neargye
e15c38ac65
update tests
2019-08-19 21:58:58 +05:00
neargye
777792339c
clean-up ostream operator
2019-08-19 20:44:08 +05:00
terik23
172c685547
improve name_impl, ostream_operators
2019-07-25 00:37:59 +05:00