tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
bit_xor.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_FUNCTIONAL_BIT_XOR_HPP
5#define TETL_FUNCTIONAL_BIT_XOR_HPP
6
7#include <etl/_utility/forward.hpp>
8
9namespace etl {
10
11/// \brief Function object for performing bitwise XOR. Effectively calls
12/// operator^ on type T.
13/// https://en.cppreference.com/w/cpp/utility/functional/bit_xor
14template <typename T = void>
15struct bit_xor {
16 [[nodiscard]] constexpr auto operator()(T const& lhs, T const& rhs) const -> T
17 {
18 return lhs ^ rhs;
19 }
20};
21
22template <>
23struct bit_xor<void> {
24 using is_transparent = void;
25
26 template <typename T, typename U>
27 [[nodiscard]] constexpr auto
28 operator()(T&& lhs, U&& rhs) const noexcept(noexcept(etl::forward<T>(lhs) ^ etl::forward<U>(rhs)))
29 -> decltype(etl::forward<T>(lhs) ^ etl::forward<U>(rhs))
30 {
31 return etl::forward<T>(lhs) ^ etl::forward<U>(rhs);
32 }
33};
34
35} // namespace etl
36
37#endif // TETL_FUNCTIONAL_BIT_XOR_HPP
Definition adjacent_find.hpp:9
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_xor.hpp:28
Function object for performing bitwise XOR. Effectively calls operator^ on type T....
Definition bit_xor.hpp:15
constexpr auto operator()(T const &lhs, T const &rhs) const -> T
Definition bit_xor.hpp:16