libMesh
Public Types | Public Member Functions | List of all members
libMesh::Utility::CompareUnderlying Struct Reference

Struct which defines a custom comparison object that can be used with std::sets of std::unique_ptrs. More...

#include <utility.h>

Public Types

using is_transparent = void
 As of C++14, std::set::find() can be a templated overload. More...
 

Public Member Functions

template<class T >
bool operator() (const std::unique_ptr< T > &a, const std::unique_ptr< T > &b) const
 This is already what the default operator< comparison for std::unique_ptrs does, we are not adding anything here. More...
 
template<class T >
bool operator() (const std::unique_ptr< T > &a, const T *const &b) const
 operator< comparison when rhs is a dumb pointer More...
 
template<class T >
bool operator() (const T *const &a, const std::unique_ptr< T > &b) const
 operator< comparison when lhs is a dumb pointer More...
 

Detailed Description

Struct which defines a custom comparison object that can be used with std::sets of std::unique_ptrs.

Definition at line 517 of file utility.h.

Member Typedef Documentation

◆ is_transparent

As of C++14, std::set::find() can be a templated overload.

https://en.cppreference.com/w/cpp/container/set/find We enable this by defining is_transparent as a type.

Definition at line 524 of file utility.h.

Member Function Documentation

◆ operator()() [1/3]

template<class T >
bool libMesh::Utility::CompareUnderlying::operator() ( const std::unique_ptr< T > &  a,
const std::unique_ptr< T > &  b 
) const
inline

This is already what the default operator< comparison for std::unique_ptrs does, we are not adding anything here.

Definition at line 531 of file utility.h.

532  {
533  return a.get() < b.get();
534  }

◆ operator()() [2/3]

template<class T >
bool libMesh::Utility::CompareUnderlying::operator() ( const std::unique_ptr< T > &  a,
const T *const &  b 
) const
inline

operator< comparison when rhs is a dumb pointer

Definition at line 540 of file utility.h.

541  {
542  return a.get() < b;
543  }

◆ operator()() [3/3]

template<class T >
bool libMesh::Utility::CompareUnderlying::operator() ( const T *const &  a,
const std::unique_ptr< T > &  b 
) const
inline

operator< comparison when lhs is a dumb pointer

Definition at line 549 of file utility.h.

550  {
551  return a < b.get();
552  }

The documentation for this struct was generated from the following file: