summaryrefslogtreecommitdiffstats
path: root/ue5/array.hpp
diff options
context:
space:
mode:
authormanuel <manuel@nc8430>2009-06-06 13:39:22 +0200
committermanuel <manuel@nc8430>2009-06-06 13:39:22 +0200
commit3dba5d5f9ff6f04593a5822a4548e787392f4db7 (patch)
treefd8778dba535a925de9814bcbd77a6a26ca8038a /ue5/array.hpp
parent2c0bf4d7935626ef299f1be3f992b1dfe4c0b19f (diff)
downloadooprog-3dba5d5f9ff6f04593a5822a4548e787392f4db7.tar.gz
ooprog-3dba5d5f9ff6f04593a5822a4548e787392f4db7.tar.bz2
ooprog-3dba5d5f9ff6f04593a5822a4548e787392f4db7.zip
using some stl-methods
removing todos
Diffstat (limited to 'ue5/array.hpp')
-rw-r--r--ue5/array.hpp20
1 files changed, 6 insertions, 14 deletions
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 @@
1#ifndef ARRAY_H 1#ifndef ARRAY_H
2#define ARRAY_H 2#define ARRAY_H
3 3
4#include <utility>
5#include <algorithm>
6#include <stdexcept>
7
4#undef SOLVED_2 8#undef SOLVED_2
5#define SOLVED_2 9#define SOLVED_2
6 10
7#include <utility> // for std::move
8#include <stdexcept> // for std::out_of_range
9
10namespace Ti 11namespace Ti
11{ 12{
12 template<typename T, std::size_t N> 13 template<typename T, std::size_t N>
@@ -22,21 +23,12 @@ namespace Ti
22 23
23 void fill(const T& u) 24 void fill(const T& u)
24 { 25 {
25 /* std::fill_n(begin(), size(), u); */ 26 std::fill_n(begin(), N, u);
26 for(size_type i = 0; i < N; ++i)
27 m_data[i] = u;
28 } 27 }
29 28
30 /* range check not necessary. N must be the same in other */
31 void swap(array<T,N> & other) 29 void swap(array<T,N> & other)
32 { 30 {
33 /* std::swap_ranges(begin(), end(), other.begin()); */ 31 std::swap_ranges(begin(), end(), other.begin());
34 for(size_type i = 0; i < N; ++i)
35 {
36 T x(m_data[i]);
37 m_data[i] = other.m_data[i];
38 other.m_data[i] = x;
39 }
40 } 32 }
41 33
42 iterator begin() 34 iterator begin()