tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
is_function.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_TYPE_TRAITS_IS_FUNCTION_HPP
5#define TETL_TYPE_TRAITS_IS_FUNCTION_HPP
6
7#include <etl/_config/all.hpp>
8
9#include <etl/_type_traits/bool_constant.hpp>
10#include <etl/_type_traits/is_const.hpp>
11#include <etl/_type_traits/is_reference.hpp>
12
13namespace etl {
14
15#if defined(TETL_COMPILER_MSVC)
16 // Qualifier applied to function has no meaning
17 #pragma warning(disable: 4180)
18#endif
19
20template <typename T>
21struct is_function : bool_constant<not is_const_v<T const> and not is_reference_v<T>> { };
22
23#if defined(TETL_COMPILER_MSVC)
24 // Qualifier applied to function has no meaning
25 #pragma warning(default: 4180)
26#endif
27
28/// \brief Checks whether T is a function type. Types like etl::inplace_function,
29/// lambdas, classes with overloaded operator() and pointers to functions don't
30/// count as function types. Provides the member constant value which is equal
31/// to true, if T is a function type. Otherwise, value is equal to false.
32///
33/// \details The behavior of a program that adds specializations for is_function
34/// or is_function_v is undefined.
35template <typename T>
36inline constexpr bool is_function_v = is_function<T>::value;
37
38} // namespace etl
39
40#endif // TETL_TYPE_TRAITS_IS_FUNCTION_HPP
Definition adjacent_find.hpp:9
constexpr bool is_function_v
Checks whether T is a function type. Types like etl::inplace_function, lambdas, classes with overload...
Definition is_function.hpp:36