aboutsummaryrefslogtreecommitdiff
path: root/cpp08/ex01/span.hpp
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-12-15 14:25:57 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-12-15 14:25:57 +0100
commit4115f22c50ee0571e88a8ec44c0241693af7ed38 (patch)
tree9e702e34ba360aa5f10f8f84b37b97b6ca8dd731 /cpp08/ex01/span.hpp
parent78efa932fb42289904fe542cfc152978397ae37c (diff)
downloadpiscine_cpp-4115f22c50ee0571e88a8ec44c0241693af7ed38.tar.gz
piscine_cpp-4115f22c50ee0571e88a8ec44c0241693af7ed38.tar.bz2
piscine_cpp-4115f22c50ee0571e88a8ec44c0241693af7ed38.zip
Fixing cpp08/{00,01}
Diffstat (limited to 'cpp08/ex01/span.hpp')
-rw-r--r--cpp08/ex01/span.hpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/cpp08/ex01/span.hpp b/cpp08/ex01/span.hpp
index 0af8453..6b72fb5 100644
--- a/cpp08/ex01/span.hpp
+++ b/cpp08/ex01/span.hpp
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/15 06:55:07 by charles #+# #+# */
-/* Updated: 2020/04/15 07:19:46 by charles ### ########.fr */
+/* Updated: 2020/12/15 12:22:31 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -24,14 +24,25 @@ public:
~Span();
Span(unsigned int n);
+
void addNumber(int x);
+
+ template <typename InputIterator>
+ void addNumber(InputIterator begin, InputIterator end)
+ {
+ for (; begin != end; ++begin)
+ addNumber(*begin);
+ }
+
int shortestSpan() const;
- int longestSpan() const;
+ int longestSpan() const;
private:
- int* m_under;
+ int* m_under;
unsigned int m_size;
unsigned int m_fillIndex;
+
+ void setupSpan() const;
};
#endif