CPP08 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Span クラス

A class that stores up to N integers and calculates the shortest and longest spans. [詳解]

#include <Span.hpp>

Span 連携図
Collaboration graph

クラス

class  NotEnoughNumbersException
 An exception thrown when there are insufficient numbers to calculate the span. [詳解]
 
class  SpanFullException
 Exception thrown when Span is full. [詳解]
 

公開メンバ関数

 Span (unsigned int N)
 Constructs a Span object.
 
 Span (const Span &other)
 Copy constructor.
 
Spanoperator= (Span other)
 Assignment operator (copy-and-swap idiom).
 
 ~Span ()
 Destructor.
 
void swap (Span &other)
 Swaps the contents of two Span objects.
 
void addNumber (int number)
 Adds a single number to the span.
 
template<typename InputIterator >
void addNumber (InputIterator first, InputIterator last)
 Adds multiple numbers specifying the iterator range.
 
int shortestSpan ()
 Calculates the shortest span between stored numbers.
 
int longestSpan ()
 Calculates the longest span between stored numbers.
 

詳解

A class that stores up to N integers and calculates the shortest and longest spans.

Span refers to the difference between any two numbers in the stored values.

Span.hpp32 行目に定義があります。

構築子と解体子

◆ Span() [1/2]

Span::Span ( unsigned int  N)
explicit

Constructs a Span object.

引数
NThe maximum number of values that can be stored.

Span.cpp22 行目に定義があります。

◆ Span() [2/2]

Span::Span ( const Span other)

Copy constructor.

引数
otherSpan object to be copied.

Span.cpp27 行目に定義があります。

◆ ~Span()

Span::~Span ( )

Destructor.

Span.cpp42 行目に定義があります。

関数詳解

◆ addNumber() [1/2]

template<typename InputIterator >
void Span::addNumber ( InputIterator  first,
InputIterator  last 
)
inline

Adds multiple numbers specifying the iterator range.

テンプレート引数
InputIteratorInput iterator type.
引数
firstIterator indicating the start of the range.
lastIterator indicating the end of the range.
例外
SpanFullExceptionThrown when capacity is insufficient.

Span.hpp85 行目に定義があります。

◆ addNumber() [2/2]

void Span::addNumber ( int  number)

Adds a single number to the span.

引数
numberThe integer to be added.
例外
SpanFullExceptionThrown when the span is full.

Span.cpp45 行目に定義があります。

◆ longestSpan()

int Span::longestSpan ( )

Calculates the longest span between stored numbers.

戻り値
The longest span.
例外
NotEnoughNumbersExceptionThrown when there are less than two numbers.

Span.cpp74 行目に定義があります。

◆ operator=()

Span & Span::operator= ( Span  other)

Assignment operator (copy-and-swap idiom).

引数
otherSpan object to be assigned.
戻り値
Reference to *this.

Span.cpp36 行目に定義があります。

◆ shortestSpan()

int Span::shortestSpan ( )

Calculates the shortest span between stored numbers.

戻り値
The shortest span.
例外
NotEnoughNumbersExceptionThrown when there are less than two numbers.

Span.cpp53 行目に定義があります。

◆ swap()

void Span::swap ( Span other)

Swaps the contents of two Span objects.

引数
otherThe Span object to be swapped.

Span.cpp30 行目に定義があります。


このクラス詳解は次のファイルから抽出されました: