---
title: llarp/util/compare_ptr.hpp

---

# llarp/util/compare_ptr.hpp



## Namespaces

| Name           |
| -------------- |
| **[llarp](Namespaces/namespacellarp.md)** <br>[crypto.hpp] |

## Classes

|                | Name           |
| -------------- | -------------- |
| struct | **[llarp::ComparePtr](Classes/structllarp_1_1ComparePtr.md)** <br>type for comparing smart pointer's managed values  |




## Source code

```cpp
#pragma once
#include <functional>

namespace llarp
{
  template <typename Ptr_t, typename Compare = std::less<>>
  struct ComparePtr
  {
    bool
    operator()(const Ptr_t& left, const Ptr_t& right) const
    {
      if (left && right)
        return Compare()(*left, *right);

      return Compare()(left, right);
    }
  };
}  // namespace llarp
```


-------------------------------

Updated on 2022-08-30 at 18:09:28 +0000
