1 |
douglas |
14 |
// Truck Computer Dooom! |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
/* Menes - C++ High-Level Utility Library |
8 |
|
|
* Copyright (C) 2005 Jay Freeman (saurik) |
9 |
|
|
*/ |
10 |
|
|
|
11 |
|
|
/* |
12 |
|
|
* Redistribution and use in source and binary |
13 |
|
|
* forms, with or without modification, are permitted |
14 |
|
|
* provided that the following conditions are met: |
15 |
|
|
* |
16 |
|
|
* 1. Redistributions of source code must retain the |
17 |
|
|
* above copyright notice, this list of conditions |
18 |
|
|
* and the following disclaimer. |
19 |
|
|
* 2. Redistributions in binary form must reproduce the |
20 |
|
|
* above copyright notice, this list of conditions |
21 |
|
|
* and the following disclaimer in the documentation |
22 |
|
|
* and/or other materials provided with the |
23 |
|
|
* distribution. |
24 |
|
|
* 3. The name of the author may not be used to endorse |
25 |
|
|
* or promote products derived from this software |
26 |
|
|
* without specific prior written permission. |
27 |
|
|
* |
28 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' |
29 |
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, |
30 |
|
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
31 |
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
32 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE |
33 |
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
34 |
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
35 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
36 |
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
37 |
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
38 |
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
39 |
|
|
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
40 |
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
41 |
|
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
42 |
|
|
*/ |
43 |
|
|
|
44 |
|
|
#ifndef _vector_hpp_ |
45 |
|
|
#define _vector_hpp_ |
46 |
|
|
|
47 |
|
|
#include <vector> |
48 |
|
|
|
49 |
|
|
template <typename Element_> |
50 |
|
|
class VectorHelper : public std::vector<Element_> |
51 |
|
|
{ |
52 |
|
|
private: |
53 |
|
|
typedef std::vector<Element_> Base_; |
54 |
|
|
|
55 |
|
|
public: |
56 |
|
|
VectorHelper() { |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
template <typename Arg0_> |
60 |
|
|
VectorHelper(const Arg0_ &arg0) { |
61 |
|
|
Base_::reserve(1); |
62 |
|
|
push_back(arg0); |
63 |
|
|
} |
64 |
|
|
|
65 |
|
|
template <typename Arg0_, typename Arg1_> |
66 |
|
|
VectorHelper(const Arg0_ &arg0, const Arg1_ &arg1) { |
67 |
|
|
Base_::reserve(2); |
68 |
|
|
push_back(arg0); |
69 |
|
|
push_back(arg1); |
70 |
|
|
} |
71 |
|
|
|
72 |
|
|
template <typename Arg0_, typename Arg1_, typename Arg2_> |
73 |
|
|
VectorHelper(const Arg0_ &arg0, const Arg1_ &arg1, const Arg2_ &arg2) { |
74 |
|
|
Base_::reserve(3); |
75 |
|
|
push_back(arg0); |
76 |
|
|
push_back(arg1); |
77 |
|
|
push_back(arg2); |
78 |
|
|
} |
79 |
|
|
|
80 |
|
|
template <typename Arg0_, typename Arg1_, typename Arg2_, typename Arg3_> |
81 |
|
|
VectorHelper(const Arg0_ &arg0, const Arg1_ &arg1, const Arg2_ &arg2, const Arg3_ &arg3) { |
82 |
|
|
Base_::reserve(4); |
83 |
|
|
push_back(arg0); |
84 |
|
|
push_back(arg1); |
85 |
|
|
push_back(arg2); |
86 |
|
|
push_back(arg3); |
87 |
|
|
} |
88 |
|
|
|
89 |
|
|
template <typename Arg0_, typename Arg1_, typename Arg2_, typename Arg3_, typename Arg4_> |
90 |
|
|
VectorHelper(const Arg0_ &arg0, const Arg1_ &arg1, const Arg2_ &arg2, const Arg3_ &arg3, const Arg4_ &arg4) { |
91 |
|
|
Base_::reserve(5); |
92 |
|
|
push_back(arg0); |
93 |
|
|
push_back(arg1); |
94 |
|
|
push_back(arg2); |
95 |
|
|
push_back(arg3); |
96 |
|
|
push_back(arg4); |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
template <typename Arg0_, typename Arg1_, typename Arg2_, typename Arg3_, typename Arg4_, typename Arg5_> |
100 |
|
|
VectorHelper(const Arg0_ &arg0, const Arg1_ &arg1, const Arg2_ &arg2, const Arg3_ &arg3, const Arg4_ &arg4, const Arg5_ &arg5) { |
101 |
|
|
Base_::reserve(6); |
102 |
|
|
push_back(arg0); |
103 |
|
|
push_back(arg1); |
104 |
|
|
push_back(arg2); |
105 |
|
|
push_back(arg3); |
106 |
|
|
push_back(arg4); |
107 |
|
|
push_back(arg5); |
108 |
|
|
} |
109 |
|
|
|
110 |
|
|
template <typename Arg0_, typename Arg1_, typename Arg2_, typename Arg3_, typename Arg4_, typename Arg5_, typename Arg6_> |
111 |
|
|
VectorHelper(const Arg0_ &arg0, const Arg1_ &arg1, const Arg2_ &arg2, const Arg3_ &arg3, const Arg4_ &arg4, const Arg5_ &arg5, const Arg6_ &arg6) { |
112 |
|
|
Base_::reserve(7); |
113 |
|
|
push_back(arg0); |
114 |
|
|
push_back(arg1); |
115 |
|
|
push_back(arg2); |
116 |
|
|
push_back(arg3); |
117 |
|
|
push_back(arg4); |
118 |
|
|
push_back(arg5); |
119 |
|
|
push_back(arg6); |
120 |
|
|
} |
121 |
|
|
|
122 |
|
|
template <typename Arg0_, typename Arg1_, typename Arg2_, typename Arg3_, typename Arg4_, typename Arg5_, typename Arg6_, typename Arg7_> |
123 |
|
|
VectorHelper(const Arg0_ &arg0, const Arg1_ &arg1, const Arg2_ &arg2, const Arg3_ &arg3, const Arg4_ &arg4, const Arg5_ &arg5, const Arg6_ &arg6, const Arg7_ &arg7) { |
124 |
|
|
Base_::reserve(8); |
125 |
|
|
push_back(arg0); |
126 |
|
|
push_back(arg1); |
127 |
|
|
push_back(arg2); |
128 |
|
|
push_back(arg3); |
129 |
|
|
push_back(arg4); |
130 |
|
|
push_back(arg5); |
131 |
|
|
push_back(arg6); |
132 |
|
|
push_back(arg7); |
133 |
|
|
} |
134 |
|
|
}; |
135 |
|
|
|
136 |
|
|
#define _L std::vector |
137 |
|
|
#define _V VectorHelper |
138 |
|
|
|
139 |
|
|
#endif//_vector_hpp_ |