From 3dba5d5f9ff6f04593a5822a4548e787392f4db7 Mon Sep 17 00:00:00 2001 From: manuel Date: Sat, 6 Jun 2009 13:39:22 +0200 Subject: using some stl-methods removing todos --- ue5/array.hpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'ue5/array.hpp') diff --git a/ue5/array.hpp b/ue5/array.hpp index e9adc55..0acd37d 100644 --- a/ue5/array.hpp +++ b/ue5/array.hpp @@ -1,12 +1,13 @@ #ifndef ARRAY_H #define ARRAY_H +#include +#include +#include + #undef SOLVED_2 #define SOLVED_2 -#include // for std::move -#include // for std::out_of_range - namespace Ti { template @@ -22,21 +23,12 @@ namespace Ti void fill(const T& u) { - /* std::fill_n(begin(), size(), u); */ - for(size_type i = 0; i < N; ++i) - m_data[i] = u; + std::fill_n(begin(), N, u); } - /* range check not necessary. N must be the same in other */ void swap(array & other) { - /* std::swap_ranges(begin(), end(), other.begin()); */ - for(size_type i = 0; i < N; ++i) - { - T x(m_data[i]); - m_data[i] = other.m_data[i]; - other.m_data[i] = x; - } + std::swap_ranges(begin(), end(), other.begin()); } iterator begin() -- cgit v1.2.3