Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
always_false.hpp
Go to the documentation of this file.
1// Copyright 2024, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_ALWAYS_FALSE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_ALWAYS_FALSE_HPP_
7
8// IWYU pragma: private, include "arene/base/type_traits.hpp"
9// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
10
11namespace arene {
12namespace base {
13
14/// @brief A trait which always is false, as a type-dependent expression.
15///
16/// @tparam T has no impact on the result, but must result in @c always_false_v<T> being a type-dependent expression.
17///
18/// This is generally used in order to allow having a "fallback" case in a template specialization set which triggers a
19/// more meaningful error than "no definition found." Before C++23, the expression @c static_assert(false,"message")
20/// will _unconditionally_ trigger a compiler error, even if the expression is in an uninstantiated template. @c
21/// always_false_v<T> works around this by making the expression type-dependant, like so:
22///
23/// @snippet docs/examples/type_traits_examples.cpp always_false_usage_example
24template <typename T>
25constexpr bool always_false_v = false;
26
27} // namespace base
28} // namespace arene
29
30#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_TRAITS_ALWAYS_FALSE_HPP_
Definition array_exceptions_disabled.cpp:11
constexpr bool always_false_v
A trait which always is false, as a type-dependent expression.
Definition always_false.hpp:25
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10