ALib C++ Library
Library Version: 2510 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
20 namespace 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
37 {
38 return src.Hashcode();
39 }
40};
41
42//==================================================================================================
43/// Specialization of functor <c>std::equal_to</c> for type \alib{boxing;Box}.
44///
45/// This specialization is provided with the inclusion of header-file
46/// \implude{Boxing.StdFunctors}.<br>
47/// While the documentation indicates namespace <c>alib::compatibility::std</c>, the
48/// specialization is (as needed) implemented in namespace <c>std</c>.
49//==================================================================================================
50template<> struct equal_to<alib::boxing::Box>
51{
52 /// Invokes \alib{boxing;Box::operator==} passing \p{lhs} and \p{rhs}.
53 /// @param lhs The left-hand side box.
54 /// @param rhs The right-hand side box.
55 /// @return The result of the comparison.
57 const alib::boxing::Box& rhs ) const
58 {
59 return lhs.operator==( rhs );
60 }
61
62};
63
64//==================================================================================================
65/// Specialization of functor <c>std::less</c> for type \alib{boxing;Box}.
66///
67/// For the comparison, box-function \alib{boxing;FIsLess} is invoked on \p{lhs} with passing
68/// \p{rhs}.
69///
70/// This specialization is provided with the inclusion of header-file
71/// \implude{Boxing.StdFunctors}.<br>
72/// While the documentation indicates namespace <c>alib::compatibility::std</c>, the
73/// specialization is (as needed) implemented in namespace <c>std</c>.
74//==================================================================================================
75template<> struct less<alib::boxing::Box>
76{
77 /// Invokes box-function \alib{boxing;FIsLess} on \p{lhs} and returns the result.
78 /// @param lhs The left-hand side box.
79 /// @param rhs The right-hand side box.
80 /// @return The result of the comparison.
82 const alib::boxing::Box& rhs) const
83 {
84 return lhs.operator<( rhs );
85 }
86
87};
88
89//==================================================================================================
90/// Specialization of functor <c>std::hash</c> for type \alib{boxing;Enum}.
91///
92/// This specialization is provided with the inclusion of header-file
93/// \implude{Boxing.StdFunctors}.<br>
94/// While the documentation indicates namespace <c>alib::compatibility::std</c>, the
95/// specialization is (as needed) implemented in namespace <c>std</c>.
96//==================================================================================================
97template<> struct hash<alib::boxing::Enum>
98{
99 /// Calculates the hash code for class \b Enum.
100 /// @param src The \b %Enum object to hash.
101 /// @return The hash code.
102 size_t operator()(const alib::boxing::Enum& src) const
103 {
104 return src.Hashcode();
105 }
106};
107
108//==================================================================================================
109/// Specialization of functor <c>std::equal_to</c> for type \alib{boxing;Enum}.
110///
111/// This specialization is provided with the inclusion of header-file
112/// \implude{Boxing.StdFunctors}.<br>
113/// While the documentation indicates namespace <c>alib::compatibility::std</c>, the
114/// specialization is (as needed) implemented in namespace <c>std</c>.
115//==================================================================================================
116template<> struct equal_to<alib::boxing::Enum>
117{
118 /// Invokes \alib{boxing;Enum::operator==} on \p{lhs} and \p{rhs}.
119 /// @param lhs The left-hand side \b %Enum.
120 /// @param rhs The right-hand side \b %Enum.
121 /// @return The result of the comparison.
123 const alib::boxing::Enum rhs) const
124 {
125 return lhs == rhs;
126 }
127};
128
129//==================================================================================================
130/// Specialization of functor <c>std::less</c> for type \alib{boxing;Enum}.
131///
132/// This specialization is provided with the inclusion of header-file
133/// \implude{Boxing.StdFunctors}.<br>
134/// While the documentation indicates namespace <c>alib::compatibility::std</c>, the
135/// specialization is (as needed) implemented in namespace <c>std</c>.
136//==================================================================================================
137template<> struct less<alib::boxing::Enum>
138{
139 /// Invokes box-function \alib{boxing;FIsLess} on \p{lhs} and returns the result.
140 /// @param lhs The left-hand side \b Enum.
141 /// @param rhs The right-hand side \b Enum.
142 /// @return The result of the comparison.
144 const alib::boxing::Enum& rhs) const
145 {
146 return lhs < rhs;
147 }
148
149};
150
151
152} // namespace [std]
153#endif // H_ALIB_BOXING_STDFUNCTORS
154
155
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