OGLplus (0.52.0) a C++ wrapper for OpenGL

Smart enumerations

OGLplus defines strongly-typed enumeration types like DataType, ColorBuffer, Capability, and many others, which provide additional type safety and robustness to applications, but require lenghty enumerated value name specification. This may be viewed as a downside. The "smart enumerations" are special types that simplify the usage of enumerations in certain situations without degrading the type safety.

Instead of explicitly specifying the name of the type of the enumeration:

Texture::MinFilter(TextureMinFilter::Linear);
Texture::MagFilter(TextureMagFilter::Linear);

a smart enumeration type can be used like this:

namespace se = oglplus::smart_enums;
...
Texture::MinFilter(se::Linear());
Texture::MagFilter(se::Linear());

or this:

namespace se = oglplus::smart_enums;
se::Linear linear;
...
Texture::MinFilter(linear);
Texture::MagFilter(linear);
Note
Smart enumerations are not included by oglplus/all.hpp. To use them the oglplus/opt/smart_enums.hpp file must be included.

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).