9 Commits

Author SHA1 Message Date
Piotr Kosek
7ad65be858 Fixed tests 2018-08-31 17:36:27 +02:00
Piotr Kosek
646632e43a Added indexable properties on enums:
- _to_index which return value 0... size-1
        (even if enums are note sequential)
 - _from_index used for other way around
 - _from_index_nothrow no throw version
 - _from_index_unchecked returns invalid enum
        in case arg>=size

Code and test cases added.
No documentation updates (my English is too poor for that)
2018-08-31 16:42:57 +02:00
cheparukhin
c71b891c87 Add test for ostream operator 2016-07-08 19:50:04 +01:00
Mikhail Ovchinnikov
76ad2256dd Removed double underscores from macro names.
Names containing (and not only beginning with) double underscores are
reserved in C++.

Resolves #15.
2016-02-24 12:24:56 -06:00
Anton Bachin
c1d4a1c006 Fixed #ifdef that caused some tests not to run.
Disabled some tests that were failing due to unsupported type traits in
Travis standard library installation.
2015-10-04 12:34:19 -05:00
Anton Bachin
e1e237a4ea Renamed top-level macro ENUM to BETTER_ENUM.
To reduce name clashes.

Fixes #11.
2015-10-04 11:03:08 -05:00
Anton Bachin
6c3d02b951 Fixed bug that disallowed some constant names.
The user-supplied constant names are used to declare an internal enum
type. They end up sharing a namespace with some internal library
values. Those internal values had names not prefixed with underscores.
As a result, it was impossible to declare enum constants with these
names.

Prefixed the internal names with underscores.
2015-07-11 10:23:34 -05:00
Anton Bachin
9810dd07ce Changed _size to a function.
An alternative constant _size_constant is provided for use in C++98,
for example for declaring arrays.

Also renamed underlying_traits to integral_mapping.
2015-06-19 17:05:33 -05:00
Anton Bachin
4314ad3fd3 Experimental generalization of underlying types.
With this change, the underlying type can be a non-integral type that
provides conversions to and from an integral type. See the test at
test/cxxtest/underlying.h for some examples - though they are more
verbose than strictly necessary, for testing needs.

Move constructors in underlying types are not supported. It has been
difficult so far to get constexpr code not to select the move
constructor, which is generally not constexpr, for various operations.
2015-06-11 20:39:46 -05:00