tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
negate.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
3
#ifndef TETL_FUNCTIONAL_NEGATE_HPP
4
#define TETL_FUNCTIONAL_NEGATE_HPP
5
6
#include <
etl/_utility/forward.hpp
>
7
8
namespace
etl
{
9
13
template
<
typename
T =
void
>
14
struct
negate
{
15
[[nodiscard]]
constexpr
auto
operator()
(T
const
&
arg
)
const
-> T {
return
-
arg
; }
16
};
17
18
template
<>
19
struct
negate
<void> {
20
using
is_transparent
= void;
21
22
template
<
typename
T>
23
[[nodiscard]]
constexpr
auto
operator()
(T&&
arg
)
const
noexcept
(
noexcept
(-
etl::forward<T>
(
arg
)))
24
->
decltype
(-
etl::forward<T>
(
arg
))
25
{
26
return
-
etl::forward<T>
(
arg
);
27
}
28
};
29
30
}
// namespace etl
31
32
#endif
// TETL_FUNCTIONAL_NEGATE_HPP
forward.hpp
etl::arg
constexpr auto arg(complex< T > const &z) noexcept -> T
Definition
arg.hpp:15
etl
Definition
adjacent_find.hpp:8
etl::forward
constexpr auto forward(remove_reference_t< T > ¶m) noexcept -> T &&
Forwards lvalues as either lvalues or as rvalues, depending on T. When t is a forwarding reference (a...
Definition
forward.hpp:18
etl::negate< void >::operator()
constexpr auto operator()(T &&arg) const noexcept(noexcept(-etl::forward< T >(arg))) -> decltype(-etl::forward< T >(arg))
Definition
negate.hpp:23
etl::negate< void >::is_transparent
void is_transparent
Definition
negate.hpp:20
etl::negate
Function object for performing negation. Effectively calls operator- on an instance of type T....
Definition
negate.hpp:14
etl::negate::operator()
constexpr auto operator()(T const &arg) const -> T
Definition
negate.hpp:15
include
etl
_functional
negate.hpp
Generated on Sat Mar 8 2025 16:19:59 for tetl by
1.14.0