Skip to content

Commit fb36d9a

Browse files
committed
try to fix msvs build
1 parent 898f9d8 commit fb36d9a

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

src/utki/shared_ref.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,32 @@ class shared_ref
185185
* @brief Equality operator for comparison with another object.
186186
* Needed for using shared_ref in ordered containers (e.g. std::set).
187187
* Effectively calls operator==() of the pointed-to object.
188+
* @param r - left hand side of the operator.
189+
* @param o - right hand side of the operator.
188190
* @return true if this object is equal to the other object.
189191
* @return false otherwise.
190192
*/
191193
friend constexpr bool operator==(const shared_ref& r, const object_type& o) noexcept
192194
{
193195
return r.get() == o;
194196
}
197+
198+
/**
199+
* @brief Equality operator for comparison with another object.
200+
* Needed for using shared_ref in ordered containers (e.g. std::set).
201+
* Effectively calls operator==() of the pointed-to object.
202+
* @param l - left hand side of the operator.
203+
* @param r - right hand side of the operator.
204+
* @return true if this object is equal to the other object.
205+
* @return false otherwise.
206+
*/
207+
friend constexpr bool operator==(
208+
const shared_ref& l, //
209+
const shared_ref& r
210+
) noexcept
211+
{
212+
return l.get() == r.get();
213+
}
195214
};
196215

197216
/**

tests/unit/src/shared_ref.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ const tst::set set("shared_ref", [](tst::suite& suite) {
291291
std::set<utki::shared_ref<a0>> set;
292292

293293
auto v1 = utki::make_shared<a0>(1);
294-
auto v2 = utki::make_shared<a1>(2);
295-
auto v3 = utki::make_shared<a1>(3);
294+
auto v2 = utki::make_shared<a0>(2);
295+
auto v3 = utki::make_shared<a0>(3);
296296

297297
set.insert(v1);
298298
set.insert(v2);

0 commit comments

Comments
 (0)