RESTinio
Loading...
Searching...
No Matches
compiler_features.hpp File Reference

Detection of compiler version and absence of various features. More...

#include <utility>

Go to the source code of this file.

Macros

#define RESTINIO_ENSURE_NOEXCEPT_CALL(expr)
 A wrapper around static_assert for checking that an expression is noexcept and execution of that expression.
#define RESTINIO_STATIC_ASSERT_NOEXCEPT(expr)
 A wrapper around static_assert for checking that an expression is noexcept.
#define RESTINIO_STATIC_ASSERT_NOT_NOEXCEPT(expr)
 A wrapper around static_assert for checking that an expression is not noexcept.

Detailed Description

Detection of compiler version and absence of various features.

Since
v.0.6.0

Definition in file compiler_features.hpp.

Macro Definition Documentation

◆ RESTINIO_ENSURE_NOEXCEPT_CALL

#define RESTINIO_ENSURE_NOEXCEPT_CALL ( expr)
Value:
static_assert(noexcept(expr), "this call is expected to be noexcept: " #expr); \
expr

A wrapper around static_assert for checking that an expression is noexcept and execution of that expression.

Usage example:

some_class::~some_class() noexcept {
// We should have a guarantee that this call doesn't throw.
RESTINIO_ENSURE_NOEXCEPT_CALL(m_some_resouce.release());
...
}
#define RESTINIO_ENSURE_NOEXCEPT_CALL(expr)
A wrapper around static_assert for checking that an expression is noexcept and execution of that expr...
Attention
This macro is a part of RESTinio and is not intended to be uses as a part of public API. It can be changed or remove in some future version without any prior notice.
Since
v.0.6.0

Definition at line 36 of file compiler_features.hpp.

◆ RESTINIO_STATIC_ASSERT_NOEXCEPT

#define RESTINIO_STATIC_ASSERT_NOEXCEPT ( expr)
Value:
static_assert(noexcept(expr), #expr " is expected to be noexcept" )

A wrapper around static_assert for checking that an expression is noexcept.

Usage example:

void remove_appropriate_items_at_front(some_container_t & cnt) noexcept {
while(!cnt.empty() && some_confitions(cnt.front()) {
// We don't expect exceptions here.
cnt.pop_front();
}
}
#define RESTINIO_STATIC_ASSERT_NOEXCEPT(expr)
A wrapper around static_assert for checking that an expression is noexcept.
Attention
This macro is a part of RESTinio and is not intended to be uses as a part of public API. It can be changed or remove in some future version without any prior notice.
Since
v.0.6.0

Definition at line 65 of file compiler_features.hpp.

◆ RESTINIO_STATIC_ASSERT_NOT_NOEXCEPT

#define RESTINIO_STATIC_ASSERT_NOT_NOEXCEPT ( expr)
Value:
static_assert(!noexcept(expr), #expr " is not expected to be noexcept" )

A wrapper around static_assert for checking that an expression is not noexcept.

Usage example:

some_class::~some_class() noexcept {
// If that call throws then we have to use try-catch block.
RESTINIO_STATIC_ASSERT_NOT_NOEXCEPT(m_some_resouce.release());
try {
m_some_resouce.release();
}
catch(...) {}
...
}
#define RESTINIO_STATIC_ASSERT_NOT_NOEXCEPT(expr)
A wrapper around static_assert for checking that an expression is not noexcept.
Attention
This macro is a part of RESTinio and is not intended to be uses as a part of public API. It can be changed or remove in some future version without any prior notice.
Since
v.0.6.0

Definition at line 92 of file compiler_features.hpp.