CNL
2.0.2 (development)
Compositional Numeric Library
unreachable.h
1
2
// Copyright John McFarlane 2018.
3
// Distributed under the Boost Software License, Version 1.0.
4
// (See accompanying file ../LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
7
#if !defined(CNL_IMPL_UNREACHABLE_H)
8
#define CNL_IMPL_UNREACHABLE_H
9
10
#include "abort.h"
11
#include "
config.h
"
12
13
namespace
cnl
{
14
namespace
_impl {
15
#if defined(CNL_RELEASE)
16
template
<
class
Result =
void
>
17
constexpr
auto
unreachable(
char
const
*
/*message*/
) noexcept -> Result
18
{
19
#if defined(_MSC_VER)
20
__assume
(
false
);
21
#elif defined(__GNUC__)
22
__builtin_unreachable();
23
#endif
24
}
25
#else
26
template
<
class
Result =
void
>
27
constexpr Result unreachable(
char
const
* message) noexcept
28
{
29
return
abort<Result>(message);
30
}
31
#endif
32
}
33
}
34
35
#endif // CNL_IMPL_UNREACHABLE_H
cnl
compositional numeric library
Definition:
abort.h:15
config.h
definitions which can be used to configure CNL library
cnl
_impl
unreachable.h
Generated by
1.8.17