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