ALib C++ Library
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
ALib.Boxing.StdFunctors.H
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of the \aliblong.
4///
5/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
8#ifndef H_ALIB_BOXING_STDFUNCTORS
9#define H_ALIB_BOXING_STDFUNCTORS
10#pragma once
11#ifndef INL_ALIB
12# include "alib/alib.inl"
13#endif
14
15#include "ALib.Boxing.H"
16
17#if DOXYGEN
19#else
20namespace std {
21#endif
22
23//==================================================================================================
24/// Specialization of functor <c>std::hash</c> for type \alib{boxing;Box}.
25///
26/// This specialization is provided with the inclusion of header-file
27/// \implude{Boxing.StdFunctors}.<br>
28/// While the documentation indicates namespace <c>alib::compatibility::std</c>, the
29/// specialization is (as needed) implemented in namespace <c>std</c>.
30//==================================================================================================
31template<> struct hash<alib::boxing::Box>
32{
33 /// Invokes and returns the result of box-function \alib{boxing;FHashcode}.
34 /// @param src The box object to hash.
35 /// @return The hash code.
36 size_t operator()(const alib::boxing::Box& src) const { return src.Hashcode(); }
37};
38
39//==================================================================================================
40/// Specialization of functor <c>std::equal_to</c> for type \alib{boxing;Box}.
41///
42/// This specialization is provided with the inclusion of header-file
43/// \implude{Boxing.StdFunctors}.<br>
44/// While the documentation indicates namespace <c>alib::compatibility::std</c>, the
45/// specialization is (as needed) implemented in namespace <c>std</c>.
46//==================================================================================================
47template<> struct equal_to<alib::boxing::Box>
48{
49 /// Invokes \alib{boxing;Box::operator==} passing \p{lhs} and \p{rhs}.
50 /// @param lhs The left-hand side box.
51 /// @param rhs The right-hand side box.
52 /// @return The result of the comparison.
54 const alib::boxing::Box& rhs ) const { return lhs.operator==( rhs ); }
55
56};
57
58//==================================================================================================
59/// Specialization of functor <c>std::less</c> for type \alib{boxing;Box}.
60///
61/// For the comparison, box-function \alib{boxing;FIsLess} is invoked on \p{lhs} with passing
62/// \p{rhs}.
63///
64/// This specialization is provided with the inclusion of header-file
65/// \implude{Boxing.StdFunctors}.<br>
66/// While the documentation indicates namespace <c>alib::compatibility::std</c>, the
67/// specialization is (as needed) implemented in namespace <c>std</c>.
68//==================================================================================================
69template<> struct less<alib::boxing::Box>
70{
71 /// Invokes box-function \alib{boxing;FIsLess} on \p{lhs} and returns the result.
72 /// @param lhs The left-hand side box.
73 /// @param rhs The right-hand side box.
74 /// @return The result of the comparison.
76 const alib::boxing::Box& rhs) const { return lhs.operator<( rhs ); }
77
78};
79
80//==================================================================================================
81/// Specialization of functor <c>std::hash</c> for type \alib{boxing;Enum}.
82///
83/// This specialization is provided with the inclusion of header-file
84/// \implude{Boxing.StdFunctors}.<br>
85/// While the documentation indicates namespace <c>alib::compatibility::std</c>, the
86/// specialization is (as needed) implemented in namespace <c>std</c>.
87//==================================================================================================
88template<> struct hash<alib::boxing::Enum>
89{
90 /// Calculates the hash code for class \b Enum.
91 /// @param src The \b %Enum object to hash.
92 /// @return The hash code.
93 size_t operator()(const alib::boxing::Enum& src) const { return src.Hashcode(); }
94};
95
96//==================================================================================================
97/// Specialization of functor <c>std::equal_to</c> for type \alib{boxing;Enum}.
98///
99/// This specialization is provided with the inclusion of header-file
100/// \implude{Boxing.StdFunctors}.<br>
101/// While the documentation indicates namespace <c>alib::compatibility::std</c>, the
102/// specialization is (as needed) implemented in namespace <c>std</c>.
103//==================================================================================================
104template<> struct equal_to<alib::boxing::Enum>
105{
106 /// Invokes \alib{boxing;Enum::operator==} on \p{lhs} and \p{rhs}.
107 /// @param lhs The left-hand side \b %Enum.
108 /// @param rhs The right-hand side \b %Enum.
109 /// @return The result of the comparison.
111 const alib::boxing::Enum rhs) const { return lhs == rhs; }
112};
113
114//==================================================================================================
115/// Specialization of functor <c>std::less</c> for type \alib{boxing;Enum}.
116///
117/// This specialization is provided with the inclusion of header-file
118/// \implude{Boxing.StdFunctors}.<br>
119/// While the documentation indicates namespace <c>alib::compatibility::std</c>, the
120/// specialization is (as needed) implemented in namespace <c>std</c>.
121//==================================================================================================
122template<> struct less<alib::boxing::Enum>
123{
124 /// Invokes box-function \alib{boxing;FIsLess} on \p{lhs} and returns the result.
125 /// @param lhs The left-hand side \b Enum.
126 /// @param rhs The right-hand side \b Enum.
127 /// @return The result of the comparison.
129 const alib::boxing::Enum& rhs) const { return lhs < rhs; }
130
131};
132
133
134} // namespace [std]
135#endif // H_ALIB_BOXING_STDFUNCTORS
ALIB_DLL size_t Hashcode() const
ALIB_DLL size_t Hashcode() const
bool operator()(const alib::boxing::Box &lhs, const alib::boxing::Box &rhs) const
bool operator()(const alib::boxing::Enum lhs, const alib::boxing::Enum rhs) const
bool operator()(const alib::boxing::Box &lhs, const alib::boxing::Box &rhs) const
bool operator()(const alib::boxing::Enum &lhs, const alib::boxing::Enum &rhs) const