Drake
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 <iostream>
#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

 drake
 

Functions

template<typename T >
std::ostream & operator<< (std::ostream &out, const SortedPair< T > &pair)
 Support writing a SortedPair to a stream (conditional on the support of writing the underlying type T to a stream). More...
 
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. More...
 
template<class T >
bool operator< (const SortedPair< T > &x, const SortedPair< T > &y)
 Compares two pairs using lexicographic ordering. More...
 
template<class T >
bool operator!= (const SortedPair< T > &x, const SortedPair< T > &y)
 Determine whether two SortedPair objects are not equal using operator==. More...
 
template<class T >
bool operator> (const SortedPair< T > &x, const SortedPair< T > &y)
 Determines whether x > y using operator<. More...
 
template<class T >
bool operator<= (const SortedPair< T > &x, const SortedPair< T > &y)
 Determines whether x <= y using operator<. More...
 
template<class T >
bool operator>= (const SortedPair< T > &x, const SortedPair< T > &y)
 Determines whether x >= y using operator<. More...
 
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. More...
 
template<class T >
void swap (drake::SortedPair< T > &t, drake::SortedPair< T > &u)
 Implements std::swap(). More...
 

Function Documentation

◆ swap()

void std::swap ( drake::SortedPair< T > &  t,
drake::SortedPair< T > &  u 
)

Implements std::swap().