plll  1.0
helper.hpp File Reference

Helper templates. More...

#include <plll/config.hpp>

Go to the source code of this file.

Classes

struct  plll::helper::BoolToType< val >
 Conversion from compile-time known bools to types. More...
 
class  plll::helper::CompareTypes< A, B >
 A type comparison template. More...
 
struct  plll::helper::implementation::CompileTimeError< no_error >
 
struct  plll::helper::implementation::CompileTimeError< true >
 
class  plll::helper::implementation::enable_if_impl< cond, T >
 
class  plll::helper::implementation::enable_if_impl< true, T >
 
class  plll::helper::EnableIf< cond, Type >
 Allows to remove functions from overload resolution. More...
 
struct  plll::helper::IntToType< val >
 Conversion from compile-time known ints to types. More...
 
struct  plll::helper::remove_decorations< A >
 Strips decorations const, &, volatile and && from types. More...
 
struct  plll::helper::implementation::remove_decorations_impl< A >
 
struct  plll::helper::implementation::remove_decorations_impl< A & >
 
struct  plll::helper::implementation::remove_decorations_impl< const A >
 
struct  plll::helper::implementation::remove_decorations_impl< volatile A >
 
class  plll::helper::implementation::select_first_type_impl< cond, A, B >
 
class  plll::helper::implementation::select_first_type_impl< false, A, B >
 
class  plll::helper::SelectFirstType< cond, A, B >
 A type selector template. More...
 
struct  plll::helper::implementation::type_equality< A, B >
 
struct  plll::helper::implementation::type_equality< A, A >
 

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...
 

Detailed Description

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.

Macro Definition Documentation

#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.

Parameters
conditionAn expression which evaluates to an integer or bool at compile time.
IdentifierWhichIsAMessageA 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.