d08 ajouts de tests et reparation ex02

This commit is contained in:
Hugo LAMY
2022-03-19 21:39:58 +01:00
parent b3df6acd20
commit 58a7fccc49
7 changed files with 113 additions and 23 deletions

View File

@@ -68,7 +68,7 @@ bool Span::empty() const {
* PUBLIC MEMBER FUNCTIONS
*********************************************/
void Span::addNumber(int nb) {
void Span::addNumber(int nb) {
if (_container.size() >= _max)
throw std::out_of_range(B_RED "out of range number" RESET);
_container.push_back(nb);
@@ -98,8 +98,6 @@ void Span::addNumber(InputIterator first, InputIterator last) {
}
template void Span::addNumber<int*>(int*, int*);
unsigned int Span::shortestSpan() {
int const size = _container.size();
unsigned int shortest = longestSpan();
@@ -123,9 +121,3 @@ unsigned int Span::longestSpan() {
return (_sort.back() - _sort.front());
}
/*********************************************
* NESTED CLASS
*********************************************/
//void Span::Class::function() {}

View File

@@ -17,9 +17,9 @@ public:
Span & operator=( Span const & rhs );
void addNumber(int nb);
// void addNumber(int * arr, unsigned int size);
template <class InputIterator>
void addNumber(InputIterator first, InputIterator last);
// void addNumber(int * arr, unsigned int size);
unsigned int shortestSpan();
unsigned int longestSpan();

View File

@@ -1,6 +1,7 @@
#include <iostream>
#include <string>
#include "colors.h"
#include <cstdlib> // rand
#include "Span.hpp"