Francisco Jerez curroje...@riseup.net writes:
Ian Romanick i...@freedesktop.org writes:
On 08/26/2013 01:10 PM, Francisco Jerez wrote:
[...]
The thing is that defining bitwise operators separately for each enum
type, as this patch and the macro solution do, doesn't stop the compiler
From
On 08/24/2013 10:41 AM, Francisco Jerez wrote:
Chad Versace chad.vers...@linux.intel.com writes:
On 08/23/2013 02:18 PM, Paul Berry wrote:
The disadvantages are that (a) we need an explicit enum value for 0,
and (b) we can't use related operators like |= unless we define
additional
Ian Romanick i...@freedesktop.org writes:
[...]
Disadvantage (b) can be made painless with the macro I discuss below.
IMHO it would be nicer to define generic templates implementing
overloads for all bitwise operators. They would have to reference the
bitmask_enumeration_traits structure
On 08/26/2013 01:10 PM, Francisco Jerez wrote:
Ian Romanick i...@freedesktop.org writes:
[...]
Disadvantage (b) can be made painless with the macro I discuss below.
IMHO it would be nicer to define generic templates implementing
overloads for all bitwise operators. They would have to
Ian Romanick i...@freedesktop.org writes:
On 08/26/2013 01:10 PM, Francisco Jerez wrote:
[...]
The thing is that defining bitwise operators separately for each enum
type, as this patch and the macro solution do, doesn't stop the compiler
From using the corresponding built-in integer
Chad Versace chad.vers...@linux.intel.com writes:
On 08/23/2013 02:18 PM, Paul Berry wrote:
The disadvantages are that (a) we need an explicit enum value for 0,
and (b) we can't use related operators like |= unless we define
additional overloads.
Disadvantage (a) is trivial, not really a
(From a suggestion by Francisco Jerez)
If an enum represents a bitfield of flags, e.g.:
enum E {
A = 1,
B = 2,
C = 4,
D = 8,
};
then C++ normally prohibits statements like this:
enum E x = A | B;
because A and B are implicitly converted to ints before OR-ing them,
and an int can't be
This is a nice improvement over the explicit cast, which is how I've always
done it in the past - which is the ugly part of an otherwise great method
for flags. Also I use a lot with enum for clearing bits.
On Fri, Aug 23, 2013 at 3:18 PM, Paul Berry stereotype...@gmail.com wrote:
(From a
On 08/23/2013 02:18 PM, Paul Berry wrote:
The disadvantages are that (a) we need an explicit enum value for 0,
and (b) we can't use related operators like |= unless we define
additional overloads.
Disadvantage (a) is trivial, not really a problem.
Disadvantage (b) can be made painless with