Category "enums"

Can't use enum class as unordered_map key

I have a class containing an enum class. class Shader { public: enum class Type { Vertex = GL_VERTEX_SHADER, Geometry = GL_GEOMETRY_SHADE

How to get enum key by value in Typescript?

I have an enum like this: export enum Colors { RED = "RED COLOR", BLUE = "BLUE COLOR", GREEN = "GREEN COLOR" } Could you let me know how to get e

Define an "Unknown" or "NULL" value in an enum

I am defining a custom typedef Elements as follows.... typedef enum { Ar, Cl, F, He, H, Kr, Ne, N, O, Rn, Xe } Ele

Why my enum type wont work in Next.js project

I getting this error "Type 'string' is not assignable to type '"left" | "right"'." Project running on Next.js Here is my type definiton export interface TwoColu

How to use enums in C++

Suppose we have an enum like the following: enum Days {Saturday, Sunday, Tuesday, Wednesday, Thursday, Friday}; I want to create an instance of this enum and

Concatenate 2 Enumerated type variable sets

enum sup; sup=['a','b','c']; enum sup2; sup2=['d','e','f']; enum sup3; sup3=sup++sup2; I want to get an new enumerated type sup3 with all a,b,c,d,e,f.Is t

Cannot approach Typescript enum within HTML

I made an enum with Typescript to use in MyService.service.ts MyComponent.component.ts and MyComponent.component.html. export enum ConnectionResult { Succ

Add functions to an Enum

Is it possible to add functions to an Enum type in TypeScript? for example: enum Mode { landscape, portrait, // the dream... toString() { co

Why cant I make an enum's inner class public?

Testing some things out I tried o make an enum in which every one element in a enum have a different class inside. Take for example: public enum MyEnum { f

Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag'?

I just installed Python 3.6.1 for MacOS X When I attempt to run the Console(or run anything with Python3), this error is thrown: AttributeError: module 'enu

Define data type of enum in C for memory

I could not find a direct answer to this but is it possible to force a certain kind of data type for an enum in C ? e.g I have an enum for a state machine that

enum option "new" not working

I am trying to create an enum on my model and I would like one of the states to be "new" e.g. enum status: { stale: 0, new: 1, converted: 2 } It seems rails

C - forward declaration of enums?

Forward declaration of enums in C does not work for me. I searched the internet and Stack Overflow but all of the questions regarding forward declarations of en

Is it recommended to make associations to enum classes in UML class diagrams?

I am designing a class diagram and I got a doubt: I have a class which have several attributes referring to Java enums and other classes that will be mapped as

Hibernate not persisting enums (as String)

I'm trying to do simple thing, save with Hibernate enum value as string. My mapping looks like this: @Entity @Table(name = "CONTRACTOR") public class Contracto

Multiple If-else or enum - which one is preferable and why? [closed]

Here is the original code: public class FruitGrower { public void growAFruit(String type) { if ("wtrmln".equals(type)) {

How to compare Enums in Python?

Since Python 3.4, the Enum class exists. I am writing a program, where some constants have a specific order and I wonder which way is the most pythonic to comp

How to write a function that only accepts one enum variant as input?

I have an enum: enum Group { OfTwo { first: usize, second: usize, }, OfThree { one: usize, two: usize, three

How to write a function that only accepts one enum variant as input?

I have an enum: enum Group { OfTwo { first: usize, second: usize, }, OfThree { one: usize, two: usize, three

How to write a function that only accepts one enum variant as input?

I have an enum: enum Group { OfTwo { first: usize, second: usize, }, OfThree { one: usize, two: usize, three