Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GEO::basic_bindex< IndexType > Struct Template Reference

A couple of two indices. More...

#include <geogram/mesh/index.h>

Public Types

enum  KeepOrderType { KEEP_ORDER }
 This type is used to overload basic_bindex constructors with versions that keep the order of the stored indices. More...
 

Public Member Functions

 basic_bindex ()
 Creates an uninitialized basic_bindex.
 
 basic_bindex (IndexType i, IndexType j)
 Creates a basic_bindex from two integers. More...
 
 basic_bindex (IndexType i, IndexType j, KeepOrderType order)
 Creates a basic_bindex from two integers and keeps their order. More...
 
bool operator< (const basic_bindex< IndexType > &rhs) const
 Compares two basic_bindex. More...
 
bool operator== (const basic_bindex< IndexType > &rhs) const
 Compares two basic_bindex. More...
 
bool operator!= (const basic_bindex< IndexType > &rhs) const
 Compares two basic_bindex. More...
 
 basic_bindex (const basic_bindex< IndexType > &rhs)=default
 Constructs a basic_bindex from another one. More...
 
basic_bindex< IndexType > & operator= (const basic_bindex< IndexType > &rhs)=default
 Assigns a basic_bindex to this one. More...
 

Static Public Member Functions

static basic_bindex inverse (const basic_bindex< IndexType > &b)
 Computes the inverse of a basic_bindex. More...
 

Public Attributes

IndexType indices [2]
 The array of 2 indices.
 

Related Functions

(Note that these are not member functions.)

template<class IndexType >
std::ostream & operator<< (std::ostream &out, const basic_bindex< IndexType > &B)
 Writes a basic_bindex to a stream. More...
 

Detailed Description

template<class IndexType>
struct GEO::basic_bindex< IndexType >

A couple of two indices.

Can be used as a key in associative data structures (std::map, std::set). The indices are defined by IndexType, generally signed or unsigned integers.

Template Parameters
IndexTypetype of the indices

Definition at line 66 of file index.h.

Member Enumeration Documentation

◆ KeepOrderType

template<class IndexType >
enum GEO::basic_bindex::KeepOrderType

This type is used to overload basic_bindex constructors with versions that keep the order of the stored indices.

Enumerator
KEEP_ORDER 

Value to pass to basic_bindex ordered constructor

Definition at line 77 of file index.h.

Constructor & Destructor Documentation

◆ basic_bindex() [1/3]

template<class IndexType >
GEO::basic_bindex< IndexType >::basic_bindex ( IndexType  i,
IndexType  j 
)
inline

Creates a basic_bindex from two integers.

The integers are reordered.

Parameters
[in]ifirst integer
[in]jsecond integer

Definition at line 94 of file index.h.

◆ basic_bindex() [2/3]

template<class IndexType >
GEO::basic_bindex< IndexType >::basic_bindex ( IndexType  i,
IndexType  j,
KeepOrderType  order 
)
inline

Creates a basic_bindex from two integers and keeps their order.

The integers are not sorted.

Parameters
[in]ifirst integer
[in]jsecond integer
[in]orderargument of type KeepOrderType used to select the right constructor. Use basic_bindex::KEEP_ORDER for this argument.

Definition at line 117 of file index.h.

◆ basic_bindex() [3/3]

template<class IndexType >
GEO::basic_bindex< IndexType >::basic_bindex ( const basic_bindex< IndexType > &  rhs)
default

Constructs a basic_bindex from another one.

Parameters
[in]rhsthe basic_bindex this basic_bindex should be copied from

Member Function Documentation

◆ inverse()

template<class IndexType >
static basic_bindex GEO::basic_bindex< IndexType >::inverse ( const basic_bindex< IndexType > &  b)
inlinestatic

Computes the inverse of a basic_bindex.

The inverse of a basic_bindex has the same indices but in reverse order.

Parameters
[in]bthe basic_bindex
Returns
a basic_bindex with the same indices as b but in reverse order.

Definition at line 196 of file index.h.

◆ operator!=()

template<class IndexType >
bool GEO::basic_bindex< IndexType >::operator!= ( const basic_bindex< IndexType > &  rhs) const
inline

Compares two basic_bindex.

Parameters
[in]rhsthe basic_bindex to compare this basic_bindex with.
Returns
true if one of the indices in rhs differs from the index in this basic_bindex at the same position, false otherwise.

Definition at line 165 of file index.h.

◆ operator<()

template<class IndexType >
bool GEO::basic_bindex< IndexType >::operator< ( const basic_bindex< IndexType > &  rhs) const
inline

Compares two basic_bindex.

Parameters
[in]rhsthe basic_bindex to compares this basic_bindex with.
Returns
true if rhs is smaller than this basic_bindex according to the lexicographic order, false otherwise.

Definition at line 133 of file index.h.

◆ operator=()

template<class IndexType >
basic_bindex<IndexType>& GEO::basic_bindex< IndexType >::operator= ( const basic_bindex< IndexType > &  rhs)
default

Assigns a basic_bindex to this one.

Parameters
[in]rhsthe basic_bindex this basic_bindex should be assigned from
Returns
a reference to this basic_bindex

◆ operator==()

template<class IndexType >
bool GEO::basic_bindex< IndexType >::operator== ( const basic_bindex< IndexType > &  rhs) const
inline

Compares two basic_bindex.

Parameters
[in]rhsthe basic_bindex to compare this basic_bindex with.
Returns
true of all indices of this basic_bindex correspond to the indices in rhs at the same positions, false otherwise.

Definition at line 152 of file index.h.

Friends And Related Function Documentation

◆ operator<<()

template<class IndexType >
std::ostream & operator<< ( std::ostream &  out,
const basic_bindex< IndexType > &  B 
)
related

Writes a basic_bindex to a stream.

Displays all the indices of the basic_bindex B.

Parameters
[in]outthe output stream
[in]Bthe basic_bindex to write
Template Parameters
IndexTypetype of the indices
Returns
a reference to the output stream out

Definition at line 223 of file index.h.


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