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