Directory: | ./ |
---|---|
File: | include/pinocchio/utils/shared-ptr.hpp |
Date: | 2025-02-12 21:03:38 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 5 | 6 | 83.3% |
Branches: | 5 | 8 | 62.5% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // Copyright (c) 2023 INRIA | ||
3 | // | ||
4 | |||
5 | #ifndef __pinocchio_utils_shared_ptr_hpp__ | ||
6 | #define __pinocchio_utils_shared_ptr_hpp__ | ||
7 | |||
8 | #include <memory> | ||
9 | |||
10 | namespace pinocchio | ||
11 | { | ||
12 | |||
13 | /// \brief Compares two std::shared_ptr | ||
14 | /// | ||
15 | template<typename T> | ||
16 | 468 | bool compare_shared_ptr(const std::shared_ptr<T> & ptr1, const std::shared_ptr<T> & ptr2) | |
17 | { | ||
18 |
2/2✓ Branch 1 taken 235 times.
✓ Branch 2 taken 233 times.
|
468 | if (ptr1 == ptr2) |
19 | 235 | return true; | |
20 |
3/6✓ Branch 1 taken 233 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 233 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 233 times.
✗ Branch 7 not taken.
|
233 | if (ptr1 && ptr2) |
21 | 233 | return *ptr1.get() == *ptr2.get(); | |
22 | ✗ | return false; | |
23 | } | ||
24 | } // namespace pinocchio | ||
25 | |||
26 | #endif // ifndef __pinocchio_utils_shared_ptr_hpp__ | ||
27 |