tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
bit_and.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_FUNCTIONAL_BIT_AND_HPP
4#define TETL_FUNCTIONAL_BIT_AND_HPP
5
7
8namespace etl {
9
13template <typename T = void>
14struct bit_and {
15 [[nodiscard]] constexpr auto operator()(T const& lhs, T const& rhs) const -> T { return lhs & rhs; }
16};
17
19template <>
20struct bit_and<void> {
21 using is_transparent = void;
22
23 template <typename T, typename U>
24 [[nodiscard]] constexpr auto operator()(T&& lhs, U&& rhs) const
25 noexcept(noexcept(etl::forward<T>(lhs) & etl::forward<U>(rhs)))
26 -> decltype(etl::forward<T>(lhs) & etl::forward<U>(rhs))
27 {
28 return etl::forward<T>(lhs) & etl::forward<U>(rhs);
29 }
30};
31
32} // namespace etl
33
34#endif // TETL_FUNCTIONAL_BIT_AND_HPP
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_and.hpp:21
constexpr auto operator()(T &&lhs, U &&rhs) const noexcept(noexcept(etl::forward< T >(lhs) &etl::forward< U >(rhs))) -> decltype(etl::forward< T >(lhs) &etl::forward< U >(rhs))
Definition bit_and.hpp:24
Function object for performing bitwise AND. Effectively calls operator& on type T.
Definition bit_and.hpp:14
constexpr auto operator()(T const &lhs, T const &rhs) const -> T
Definition bit_and.hpp:15