Loading...
Searching...
No Matches
stdex::interval< T > Struct Template Reference

Numerical interval. More...

`#include <stdex/interval.hpp>`

## Public Member Functions

| interval () noexcept
| Constructs an invalid interval.
| interval (T x) noexcept
| Constructs a zero-size interval.
| interval (T _start, T _end) noexcept
| Constructs an interval.
T | size () const
| Returns interval size.
bool | empty () const
| Is interval empty?
void | invalidate ()
| Invalidates interval.
| operator bool () const
| Is interval valid?
bool | contains (T x) const
| Is value in interval?
interval< T > | operator+ (const interval< T > &other) const
| Adds two intervals by components.
interval< T > | operator+ (const T x) const
| Moves interval towards the end by a number.
interval< T > | operator++ ()
| Moves interval towards the end by one.
interval< T > | operator++ (int)
| Moves interval towards the end by one.
interval< T > | operator- (const interval< T > &other) const
| Subtracts two intervals by components.
interval< T > | operator- (const T x) const
| Moves interval towards the beginning by a number.
interval< T > | operator-- ()
| Moves interval towards the begginning by one.
interval< T > | operator-- (int)
| Moves interval towards the begginning by one.
bool | operator== (const interval< T > &other) const
| Are intervals identical?
bool | operator!= (const interval< T > &other) const
| Are intervals different?

## Public Attributes

T | start
| interval start
T | end
| interval end

## Detailed Description

template<class T>
struct stdex::interval< T >

Numerical interval.

## Constructor & Destructor Documentation

## interval() [1/2]

template<class T >

stdex::interval< T >::interval | ( | T | x | ) |

inlinenoexcept

Constructs a zero-size interval.

Parameters

  [in] | x | Interval start and end value

## interval() [2/2]

template<class T >

stdex::interval< T >::interval | ( | T | _start,
|  | T | _end
| ) |  |

inlinenoexcept

Constructs an interval.

Parameters

  [in] | _start | Interval start value
  [in] | _end | Interval end value

## Member Function Documentation

## contains()

template<class T >

bool stdex::interval< T >::contains | ( | T | x | ) | const

inline

Is value in interval?

Parameters

  [in] | x | Value to test

Returns
  true if x is in [start, end) or false otherwise

## empty()

template<class T >

bool stdex::interval< T >::empty | ( |  | ) | const

inline

Is interval empty?

Returns
  true if interval is empty or false otherwise

## operator bool()

template<class T >

stdex::interval< T >::operator bool | ( |  | ) | const

inline

Is interval valid?

Returns
  true if interval is valid or false otherwise

## operator!=()

template<class T >

bool stdex::interval< T >::operator!= | ( | const interval< T > & | other | ) | const

inline

Are intervals different?

Parameters

  [in] | other | Second interval to compare

Returns
  true if intervals are different or false otherwise

## operator+() [1/2]

template<class T >

interval< T > stdex::interval< T >::operator+ | ( | const interval< T > & | other | ) | const

inline

Adds two intervals by components.

Parameters

  [in] | other | Second interval

Returns
  Resulting interval

## operator+() [2/2]

template<class T >

interval< T > stdex::interval< T >::operator+ | ( | const T | x | ) | const

inline

Moves interval towards the end by a number.

Parameters

  [in] | x | Amount to move for

Returns
  Moved interval

## operator++() [1/2]

template<class T >

interval< T > stdex::interval< T >::operator++ | ( |  | ) |

inline

Moves interval towards the end by one.

Returns
  Moved interval

## operator++() [2/2]

template<class T >

interval< T > stdex::interval< T >::operator++ | ( | int |  | ) |

inline

Moves interval towards the end by one.

Returns
  Original interval

## operator-() [1/2]

template<class T >

interval< T > stdex::interval< T >::operator- | ( | const interval< T > & | other | ) | const

inline

Subtracts two intervals by components.

Parameters

  [in] | other | Second interval

Returns
  Resulting interval

## operator-() [2/2]

template<class T >

interval< T > stdex::interval< T >::operator- | ( | const T | x | ) | const

inline

Moves interval towards the beginning by a number.

Parameters

  [in] | x | Amount to move for

Returns
  Moved interval

## operator--() [1/2]

template<class T >

interval< T > stdex::interval< T >::operator-- | ( |  | ) |

inline

Moves interval towards the begginning by one.

Returns
  Moved interval

## operator--() [2/2]

template<class T >

interval< T > stdex::interval< T >::operator-- | ( | int |  | ) |

inline

Moves interval towards the begginning by one.

Returns
  Original interval

## operator==()

template<class T >

bool stdex::interval< T >::operator== | ( | const interval< T > & | other | ) | const

inline

Are intervals identical?

Parameters

  [in] | other | Second interval to compare

Returns
  true if intervals are identical or false otherwise

## size()

template<class T >

T stdex::interval< T >::size | ( |  | ) | const

inline

Returns interval size.

Returns
  Interval size or 0 if interval is invalid

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

- include/stdex/interval.hpp