stdex
Additional custom or not Standard C++ covered algorithms
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
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.
 
size () const
 Returns interval size.
 
bool empty () const
 Is interval empty?
 
 operator bool () const
 Is interval valid?
 
bool contains (T x) const
 Is value in interval?
 

Public Attributes

start
 interval start
 
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 ( x)
inlinenoexcept

Constructs a zero-size interval.

Parameters
[in]xInterval start and end value

◆ interval() [2/2]

template<class T >
stdex::interval< T >::interval ( _start,
_end 
)
inlinenoexcept

Constructs an interval.

Parameters
[in]_startInterval start value
[in]_endInterval end value

Member Function Documentation

◆ contains()

template<class T >
bool stdex::interval< T >::contains ( x) const
inline

Is value in interval?

Parameters
[in]xValue 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

◆ 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: