plll
1.0
|
Helper templates. More...
#include <plll/config.hpp>
Go to the source code of this file.
Namespaces | |
plll | |
Contains the plll library. | |
plll::helper | |
Contains some helper templates and classes. | |
Macros | |
#define | PLLL_INTERNAL_STATIC_CHECK(condition, IdentifierWhichIsAMessage) { plll::helper::implementation::CompileTimeError<((condition) != 0)> ERROR_##IdentifierWhichIsAMessage; (void)ERROR_##IdentifierWhichIsAMessage; } |
Functions | |
template<typename T > | |
T & | plll::helper::make_type_lvalue () PLLL_INTERNAL_NOTHROW_POSTFIX_ENFORCE |
This is a pseudo-template which should only be used in expressions which are never evaluated, such as sizeof() and noexcept() (in C++11). More... | |
Helper templates.
This header provides helper templates, such as static assertions (PLLL_INTERNAL_STATIC_CHECK
macro), type selection (plll::SelectFirstType<>
), int-to-type and bool-to-type facilities (IntToType<>
and BoolToType<>
) as well as a decoration remover.
Definition in file helper.hpp.
#define PLLL_INTERNAL_STATIC_CHECK | ( | condition, | |
IdentifierWhichIsAMessage | |||
) | { plll::helper::implementation::CompileTimeError<((condition) != 0)> ERROR_##IdentifierWhichIsAMessage; (void)ERROR_##IdentifierWhichIsAMessage; } |
Allows to do compile-time assertions. By writing
PLLL_INTERNAL_STATIC_CHECK(condition, IdentifierWhichIsAMessage)
the compiler will evaluate the resulting expression to nothing if condition
evaluates to true
, and produce a compilation error that it cannot instantiate ERROR_IdentifierWhichIsAMessage
(or something like that) in case condition
evaluates to false
.
condition | An expression which evaluates to an integer or bool at compile time. |
IdentifierWhichIsAMessage | A C++ identifier which will be prefixed with ERROR_ and hopefully included in the compiler's error message. |
The code was essentially taken from the Loki library by Andrei Alexandrescu. Note that in C++11, static_assert()<>
provides the same functionality.
Definition at line 83 of file helper.hpp.