Skip to content

bhandras/enum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Enum

Enum is a smarter enum for C++11 that supports conversion to/from string.

Sample usage

#include "enum.h"

MAKE_ENUM(Fruit, Apple, Banana, Orange)

std::cout << Fruit::as_string(Fruit::Apple) << std::endl;   // -> "Apple"
std::cout << Fruit::as_string(Fruit::Banana) << std::endl;  // -> "Banna"

auto a = Fruit::from_string("Banana");  // -> a == Fruit::Banana
auto b = Fruit::from_string("Cat");     // -> b == Fruit::undefined

About

enum helper for C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages