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 503 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 510 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 517 of file utility.h.

518  {
519  return a.get() < b.get();
520  }

◆ 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 526 of file utility.h.

527  {
528  return a.get() < b;
529  }

◆ 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 535 of file utility.h.

536  {
537  return a < b.get();
538  }

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