Skip to content

khustup/penum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

penum

Parameterized enums for C++, using std::variant and macros

Inspired by Swift and Rust enums.

Usage

PENUM(result)
    PCASE(success, std::string)
    PCASE(error, std::exception_ptr)
PENUM_END;

result request(...)
{
    if (request_succeeded) {
        return result::success(std::string(data));
    }
    return result::error(std::make_exception_ptr(error));
}

For usage examples please look at Examples

About

Parameterized enum for C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages