Skip to content

A C++ library to enable bitmask operators for an enum class type

License

Notifications You must be signed in to change notification settings

Reputeless/EnumBitmask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EnumBitmask

EnumBitmask is a library to enable bitmask operators for an enum class type.

Examples

# include <iostream>
# include "EnumBitmask.hpp"

enum class OpenMode
{
	Append	= 1,
	Binary	= 2,
	Input	= 4,
	Output	= 8,
};
DEFINE_BITMASK_OPERATORS(OpenMode)

int main()
{
	constexpr OpenMode openMode = OpenMode::Binary | OpenMode::Input;
	
	if (openMode & OpenMode::Binary)
	{
		std::cout << "Binary mode" << '\n';
	}
}

About

A C++ library to enable bitmask operators for an enum class type

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages