Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
not_equal_to.hpp
Go to the documentation of this file.
1// Copyright 2026, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_NOT_EQUAL_TO_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_NOT_EQUAL_TO_HPP_
7
8// parasoft-begin-suppress CERT_CPP-DCL58-a-2 "Part of a standard library implementation"
9// parasoft-begin-suppress AUTOSAR-A17_6_1-a-2 "Part of a standard library implementation"
10
11// IWYU pragma: private, include <functional>
12// IWYU pragma: friend "stdlib_detail/.*"
13
14#include "stdlib/include/stdlib_detail/forward.hpp"
15
16namespace std {
17
18/// @brief Function object that can be invoked for non-equality comparisons
19/// @tparam T The type of the values
20/// @note This class contains the member types @c result_type, @c first_argument type, and @c second_argument type.
21/// These aliases have been deprecated in C++17 and removed in C++20.
22template <class T = void>
24 public:
25 /// @brief Result type of invoking this object
26 using result_type = bool;
27 /// @brief Type of the first value to compare
28 using first_argument_type = T;
29 /// @brief Type of the second value to compare
30 using second_argument_type = T;
31
32 /// @brief Returns if two values are non-equal
33 /// @param lhs The first value to compare
34 /// @param rhs The second value to compare
35 /// @return Returns the boolean result of invoking @c operator!= on @c lhs and @c rhs
36 constexpr auto operator()(T const& lhs, T const& rhs) const noexcept(noexcept(lhs != rhs)) -> bool {
37 return lhs != rhs;
38 }
39};
40
41/// @brief Function object that can be invoked for non-equality comparisons, specialized for type deduction
42template <>
43class not_equal_to<void> {
44 public:
45 // parasoft-begin-suppress AUTOSAR-A2_10_1-e "False positive: 'is_transparent' does not hide anything"
46 /// @brief Denotes that this is a transparent function object type
47 using is_transparent = void;
48 // parasoft-end-suppress AUTOSAR-A2_10_1-e
49
50 /// @brief Returns if two values are non-equal with parameter and return type deduced
51 /// @tparam T The type of the first value
52 /// @tparam U The type of the second value
53 /// @param lhs The first value to compare
54 /// @param rhs The second value to compare
55 /// @return Returns the result of invoking @c operator!= on @c lhs and @c rhs
56 template <class T, class U>
57 constexpr auto operator()(T&& lhs, U&& rhs) const noexcept(noexcept(std::forward<T>(lhs) != std::forward<U>(rhs)))
58 -> decltype(std::forward<T>(lhs) != std::forward<U>(rhs)) {
59 return std::forward<T>(lhs) != std::forward<U>(rhs);
60 }
61};
62
63} // namespace std
64
65#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_NOT_EQUAL_TO_HPP_
constexpr auto operator()(T &&lhs, U &&rhs) const noexcept(noexcept(std::forward< T >(lhs) !=std::forward< U >(rhs))) ->
Returns if two values are non-equal with parameter and return type deduced.
Definition not_equal_to.hpp:57
Function object that can be invoked for non-equality comparisons.
Definition not_equal_to.hpp:23
constexpr auto operator()(T const &lhs, T const &rhs) const noexcept(noexcept(lhs !=rhs)) -> bool
Returns if two values are non-equal.
Definition not_equal_to.hpp:36
constexpr auto operator()(::arene::base::result< void, E > const &value) const noexcept(noexcept(hash< E >{}(std::declval< E const & >()))) -> std::size_t
Calculate the hash of a result.
Definition result.hpp:1827