MCPcopy Create free account
hub / github.com/Tessil/ordered-map / equal_to_ptr

Class equal_to_ptr

tests/ordered_map_tests.cpp:1532–1557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1530 };
1531
1532 struct equal_to_ptr {
1533 using is_transparent = std::true_type;
1534
1535 bool operator()(const std::unique_ptr<int>& p1,
1536 const std::unique_ptr<int>& p2) const {
1537 return p1 == p2;
1538 }
1539
1540 bool operator()(const std::unique_ptr<int>& p1, std::uintptr_t p2) const {
1541 return reinterpret_cast<std::uintptr_t>(p1.get()) == p2;
1542 }
1543
1544 bool operator()(std::uintptr_t p1, const std::unique_ptr<int>& p2) const {
1545 return p1 == reinterpret_cast<std::uintptr_t>(p2.get());
1546 }
1547
1548 bool operator()(const std::unique_ptr<int>& p1,
1549 const int* const& p2) const {
1550 return p1.get() == p2;
1551 }
1552
1553 bool operator()(const int* const& p1,
1554 const std::unique_ptr<int>& p2) const {
1555 return p1 == p2.get();
1556 }
1557 };
1558
1559 std::unique_ptr<int> ptr1(new int(1));
1560 std::unique_ptr<int> ptr2(new int(2));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected