CNL
2.0.2 (development)
Compositional Numeric Library
throw_exception.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_THROW_EXCEPTION_H)
8
#define CNL_THROW_EXCEPTION_H
9
10
#include "abort.h"
11
#include "
config.h
"
12
13
#include <type_traits>
14
15
namespace
cnl
{
16
namespace
_impl {
17
template
<
typename
Result,
class
Exception>
18
auto
throw_exception(
char
const
* message) -> Result
19
{
20
#if defined(CNL_EXCEPTIONS_ENABLED)
21
return
true
?
throw
Exception(message) : Result{};
22
#else
23
return
abort<Result>(message);
24
#endif
25
}
26
}
27
}
28
29
#endif // CNL_THROW_EXCEPTION_H
cnl
compositional numeric library
Definition:
abort.h:15
config.h
definitions which can be used to configure CNL library
cnl
_impl
throw_exception.h
Generated by
1.8.17