snippets 0.1.0
Loading...
Searching...
No Matches
hsc_snippets::SlidingWindowMax< T > Class Template Reference

#include <sliding_window.hpp>

Public Member Functions

 SlidingWindowMax (size_t size)
 
void update (T value)
 
std::optional< T > get_max () const
 
size_t size () const
 

Constructor & Destructor Documentation

◆ SlidingWindowMax()

template<std::integral T>
hsc_snippets::SlidingWindowMax< T >::SlidingWindowMax ( size_t size)
inlineexplicit
Parameters
sizeThe maximum size of the sliding window.

Member Function Documentation

◆ get_max()

template<std::integral T>
std::optional< T > hsc_snippets::SlidingWindowMax< T >::get_max ( ) const
inline

Retrieves the maximum value within the current window.

Returns
An optional containing the maximum value if the window is not empty; otherwise, an empty optional.

◆ size()

template<std::integral T>
size_t hsc_snippets::SlidingWindowMax< T >::size ( ) const
inline

Returns the current size of the sliding window.

Returns
The current size of the sliding window, which may be less than the maximum size.

◆ update()

template<std::integral T>
void hsc_snippets::SlidingWindowMax< T >::update ( T value)
inline

Updates the sliding window with a new value.

Parameters
valueThe new value to be added to the window.

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