Magic Enum C++
gtl
Our great sponsors
Magic Enum C++ | gtl | |
---|---|---|
44 | 5 | |
4,390 | 87 | |
- | - | |
8.4 | 7.1 | |
5 days ago | 16 days ago | |
C++ | C++ | |
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Magic Enum C++
-
What C++ library do you wish existed but hasn’t been created yet?
I'm not sure this is quite what you're asking for, but this library has been super helpful to me in the past : https://github.com/Neargye/magic_enum
- Usable Magic Enums for C++
-
Fully Permissive License C++ Logger For Embedded System
Also, a shoutout to Magic Enum: https://github.com/Neargye/magic_enum
- Favorite Ways of Stringifying Enums
-
enum_name (yet another enum to/from string conversion utility >=C++11)
What does this have to offer over magic_enum?
-
quill v2.7.0 released - Asynchronous Low Latency C++ Logging Library
But it's a hack, and I prefer not to use hacks in production, because of their significant limitations:
-
Enums print numbers instead of words
You can either write a to string(view) function for your enum or use https://github.com/Neargye/magic_enum
-
Enums with methods
Why reinvent the wheel? magic_enum
-
Error: Boost bimap can't convert const CompatibleKey to Key&
Also if you want to convert enum members to string representation I suggest you just use magic_enum instead, much smaller dependency.
-
Macro to write enum and converter from and to string
Magic Enum provides that.
gtl
-
Inside boost::concurrent_flat_map
gtl library author here. Very nice writeup! Reading it made me think, and I believe I know why gtl::parallel_flat_hash_map performs comparatively worse for high-skew scenarios (just pushed a fix in gtl).
-
Boost 1.81 will have boost::unordered_flat_map...
I do this as well in my phmap and gtl implementations. It makes the tables look worse in benchmarks like the above, but prevents really bad surprises occasionally.
-
Comprehensive C++ Hashmap Benchmarks 2022
Thanks a lot for the great benchmark, Martin. Glad you used different hash functions, because I do sacrifice some speed to make sure that the performance of my hash maps doesn't degrade drastically with poor hash functions. Happy to see that my phmap and gtl (the C++20 version) performed well.
-
It is now trivial to cache pure functions with highly efficient, concurrent cache.
This is very easy to do with the latest version of gtl. And it is extremely efficient, as the caching mechanism uses the parallel hashmap, which internally is divided into N submaps each with its own mutex, reducing mutex contention to a minimum.
-
Updating map_benchmarks: Send your hashmaps!
AFAIK sparsepp has been dropped entirely in favor of the containers in GTL: https://github.com/greg7mdp/gtl
What are some alternatives?
Nameof C++ - Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum
eytzinger - Cache-friendly associative STL-like container with an Eytzinger (BFS) layout for C++
Protobuf - Protocol Buffers - Google's data interchange format
fph-table - Flash Perfect Hash Table: an implementation of a dynamic perfect hash table, extremely fast for lookup
cereal - A C++11 library for serialization
Google Test - GoogleTest - Google Testing and Mocking Framework
FlatBuffers - FlatBuffers: Memory Efficient Serialization Library
flat_hash_map - A very fast hashtable
Boost.Serialization - Boost.org serialization module
libcudacxx - [ARCHIVED] The C++ Standard Library for your entire system. See https://github.com/NVIDIA/cccl
pfr - std::tuple like methods for user defined types without any macro or boilerplate code
google-sparsehash - Clone of google-sparsehash