Molassembler  3.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Scine::Molassembler::Temple::OrderedPair< T > Struct Template Reference

A class that imitates std::pair<T, U>, but whose template arguments are homogeneous and the stored values ordered (.first < .second). More...

#include <OrderedPair.h>

Inheritance diagram for Scine::Molassembler::Temple::OrderedPair< T >:

Public Types

Types
using value_type = T
 Type of stored elements.
 
using iterator = T *
 Iterator type.
 
using const_iterator = const T *
 Const iterator type.
 

Public Member Functions

template<typename UnaryFunction >
auto map (UnaryFunction &&mapFunction) const
 Map the pair into an unordered std::pair.
 
Constructors
constexpr OrderedPair ()=default
 Default constructor.
 
constexpr OrderedPair (T a, T b)
 Reordering pair initializer.
 
Element access
constexpr T front () const
 
constexpr T & front ()
 
constexpr T back () const
 
constexpr T & back ()
 
Iterators
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
Operators
constexpr auto tie () const
 Yields the result of std::tie(first, second)
 
- Public Member Functions inherited from Scine::Molassembler::Temple::Crtp::LexicographicComparable< OrderedPair< T > >
constexpr bool operator== (const LexicographicComparable &other) const
 
constexpr bool operator!= (const LexicographicComparable &other) const
 
constexpr bool operator< (const LexicographicComparable &other) const
 
constexpr bool operator<= (const LexicographicComparable &other) const
 
constexpr bool operator> (const LexicographicComparable &other) const
 
constexpr bool operator>= (const LexicographicComparable &other) const
 

Data Fields

State
first
 First element of the pair.
 
second
 Second element of the pair.
 

Additional Inherited Members

- Static Public Member Functions inherited from Scine::Molassembler::Temple::Crtp::LexicographicComparable< OrderedPair< T > >
static constexpr const
OrderedPair< T > & 
derived (const LexicographicComparable &base)
 

Detailed Description

template<typename T>
struct Scine::Molassembler::Temple::OrderedPair< T >

A class that imitates std::pair<T, U>, but whose template arguments are homogeneous and the stored values ordered (.first < .second).

Note
We can implement iterators for this really cheaply since the standard guarantees that successively defined same-aligment types are laid out successively in memory. Since the pair is homogeneous, we can just use a T pointer as an iterator. These do not, however, fulfill all the requirements for STL algorithms such as having typedefs for the results of various operations.

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