Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
sorted_pair.h File Reference

Detailed Description

Provides drake::MakeSortedPair and drake::SortedPair for storing two values of a certain type in sorted order.

#include <algorithm>
#include <cstddef>
#include <type_traits>
#include <utility>
#include "drake/common/hash.h"
#include "drake/common/is_less_than_comparable.h"
Include dependency graph for sorted_pair.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  SortedPair< T >
 This class is similar to the std::pair class. More...
struct  hash< drake::SortedPair< T > >
 Provides std::hash<SortedPair<T>>. More...
struct  tuple_size< drake::SortedPair< T > >
 Support using SortedPair<T> in structured bindings. More...
struct  tuple_element< Index, drake::SortedPair< T > >

Namespaces

namespace  drake
namespace  std
 STL namespace.

Functions

template<class T>
bool operator== (const SortedPair< T > &x, const SortedPair< T > &y)
 Two pairs of the same type are equal iff their members are equal after sorting.
template<class T>
bool operator< (const SortedPair< T > &x, const SortedPair< T > &y)
 Compares two pairs using lexicographic ordering.
template<class T>
bool operator!= (const SortedPair< T > &x, const SortedPair< T > &y)
 Determine whether two SortedPair objects are not equal using operator==.
template<class T>
bool operator> (const SortedPair< T > &x, const SortedPair< T > &y)
 Determines whether x > y using operator<.
template<class T>
bool operator<= (const SortedPair< T > &x, const SortedPair< T > &y)
 Determines whether x <= y using operator<.
template<class T>
bool operator>= (const SortedPair< T > &x, const SortedPair< T > &y)
 Determines whether x >= y using operator<.
template<class T>
constexpr SortedPair< typename std::decay< T >::type > MakeSortedPair (T &&x, T &&y)
 A convenience wrapper for creating a sorted pair from two objects.
template<class T>
void swap (drake::SortedPair< T > &t, drake::SortedPair< T > &u)
 Implements std::swap().