Compare commits

..

No commits in common. "master" and "0.11.3" have entirely different histories.

6 changed files with 41 additions and 7 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2012-2024, Anton Bachin Copyright (c) 2012-2020, Anton Bachin
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,

View File

@ -1,5 +1,7 @@
# Better Enums   [![Try online][wandbox-img]][wandbox] [![Travis status][travis-img]][travis] [![AppVeyor status][appveyor-img]][appveyor] # Better Enums   [![version 0.11.2][version]][releases] [![Try online][wandbox-img]][wandbox] [![Travis status][travis-img]][travis] [![AppVeyor status][appveyor-img]][appveyor]
[version]: https://img.shields.io/badge/version-0.11.2-blue.svg
[releases]: https://github.com/aantron/better-enums/releases
[wandbox]: http://melpon.org/wandbox/permlink/2QCi3cwQnplAToge [wandbox]: http://melpon.org/wandbox/permlink/2QCi3cwQnplAToge
[wandbox-img]: https://img.shields.io/badge/try%20it-online-blue.svg [wandbox-img]: https://img.shields.io/badge/try%20it-online-blue.svg
[appveyor]: https://ci.appveyor.com/project/aantron/better-enums/branch/master [appveyor]: https://ci.appveyor.com/project/aantron/better-enums/branch/master
@ -15,6 +17,10 @@ file, and without dependencies.
[sample]: https://raw.githubusercontent.com/aantron/better-enums/master/doc/image/sample.gif [sample]: https://raw.githubusercontent.com/aantron/better-enums/master/doc/image/sample.gif
**Note**: consider [**magic_enum**](https://github.com/Neargye/magic_enum)
(note it requires C++17 and a fairly recent compiler; see
[*Limitations*](https://github.com/Neargye/magic_enum/blob/master/doc/limitations.md#readme)).
In C++11, *everything* can be used at compile time. You can convert your enums, In C++11, *everything* can be used at compile time. You can convert your enums,
loop over them, [find their max][max], loop over them, [find their max][max],
[statically enforce conventions][enforce], and pass along the results as [statically enforce conventions][enforce], and pass along the results as
@ -96,6 +102,20 @@ a comparison:
<br/> <br/>
## Contact and development
Don't hesitate to contact me about features or bugs:
[antonbachin@yahoo.com][email], or open an issue on GitHub.
If you'd like to help develop Better Enums, see [`CONTRIBUTING`][contributing].
One area that could use fresh ideas is finding a compile-time data structure
that both compiles quickly and allows lookup in sub-linear time.
[email]: mailto:antonbachin@yahoo.com
[contributing]: https://github.com/aantron/better-enums/blob/master/doc/CONTRIBUTING.md
<br/>
## History ## History
The original version of the library was developed by the author in the winter of The original version of the library was developed by the author in the winter of

15
doc/Contact.md Normal file
View File

@ -0,0 +1,15 @@
## Contact
- Send me an email: [antonbachin@yahoo.com](mailto:antonbachin@yahoo.com).
- Visit the [GitHub]($repo) project to open an issue or get a development
version.
I'm happy to hear any feedback. If you have any trouble using the library or
parsing the documentation, please don't hesitate to let me know. I'd also be
interested to hear about your use case, if you are willing to share :)
And, if you find this library helpful, give it a star on GitHub to let me know
you use it :)
%% description =
Contact information for Better Enums bugs, issues, support, and feedback.

View File

@ -3,7 +3,7 @@
<footer> <footer>
<div class="container"> <div class="container">
Copyright &copy; 2015-2024 Anton Bachin. Released under the BSD 2-clause Copyright &copy; 2015-2019 Anton Bachin. Released under the BSD 2-clause
license. See license. See
<a href="https://github.com/aantron/better-enums/blob/$ref/doc/LICENSE"> <a href="https://github.com/aantron/better-enums/blob/$ref/doc/LICENSE">
LICENSE</a>. LICENSE</a>.

View File

@ -25,6 +25,7 @@ $ga
<a href="${prefix}index.html">Home</a> <a href="${prefix}index.html">Home</a>
<a href="${prefix}tutorial/HelloWorld.html">Tutorial</a> <a href="${prefix}tutorial/HelloWorld.html">Tutorial</a>
<a href="${prefix}ApiReference.html">Reference</a> <a href="${prefix}ApiReference.html">Reference</a>
<a href="${prefix}Contact.html">Contact</a>
</div> </div>
</nav> </nav>

6
enum.h
View File

@ -1,7 +1,6 @@
// This file is part of Better Enums, released under the BSD 2-clause license. // This file is part of Better Enums, released under the BSD 2-clause license.
// See LICENSE.md for details, or visit http://github.com/aantron/better-enums. // See LICENSE.md for details, or visit http://github.com/aantron/better-enums.
// clang-format off
#pragma once #pragma once
#ifndef BETTER_ENUMS_ENUM_H #ifndef BETTER_ENUMS_ENUM_H
@ -1314,7 +1313,7 @@ BETTER_ENUMS_CONSTEXPR_ map<Enum, T> make_map(T (*f)(Enum))
} }
#define BETTER_ENUMS_DECLARE_STD_HASH(type) \ #define BETTER_ENUMS_DECLARE_STD_HASH(type) \
namespace std { \ namespace std { \
template <> struct hash<type> \ template <> struct hash<type> \
{ \ { \
size_t operator()(const type &x) const \ size_t operator()(const type &x) const \
@ -1322,7 +1321,6 @@ BETTER_ENUMS_CONSTEXPR_ map<Enum, T> make_map(T (*f)(Enum))
return std::hash<size_t>()(x._to_integral()); \ return std::hash<size_t>()(x._to_integral()); \
} \ } \
}; \ }; \
} }
#endif // #ifndef BETTER_ENUMS_ENUM_H #endif // #ifndef BETTER_ENUMS_ENUM_H
// clang-format on