tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
bit_or.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_FUNCTIONAL_BIT_OR_HPP
4#define TETL_FUNCTIONAL_BIT_OR_HPP
5
7
8namespace etl {
9
14template <typename T = void>
15struct bit_or {
16 [[nodiscard]] constexpr auto operator()(T const& lhs, T const& rhs) const -> T { return lhs | rhs; }
17};
18
19template <>
20struct bit_or<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_OR_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_or.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_or.hpp:24
Function object for performing bitwise OR. Effectively calls operator| on type T.
Definition bit_or.hpp:15
constexpr auto operator()(T const &lhs, T const &rhs) const -> T
Definition bit_or.hpp:16