L4Re - L4 Runtime Environment
basic_vector.h
Go to the documentation of this file.
1 
5 /*
6  * (c) 2008-2009 Alexander Warg <warg@os.inf.tu-dresden.de>
7  * economic rights: Technische Universit├Ąt Dresden (Germany)
8  *
9  * This file is part of TUD:OS and distributed under the terms of the
10  * GNU General Public License 2.
11  * Please see the COPYING-GPL-2 file for details.
12  *
13  * As a special exception, you may use this file as part of a free software
14  * library without restriction. Specifically, if other files instantiate
15  * templates or use macros or inline functions from this file, or you compile
16  * this file and link it with other files to produce an executable, this
17  * file does not by itself cause the resulting executable to be covered by
18  * the GNU General Public License. This exception does not however
19  * invalidate any other reasons why the executable file might be covered by
20  * the GNU General Public License.
21  */
22 #pragma once
23 
24 #include <l4/cxx/std_alloc>
25 
26 namespace cxx {
27 
28 template< typename T >
29 class Basic_vector
30 {
31 public:
32  Basic_vector(T *array, unsigned long capacity)
33  : _array(array), _capacity(capacity)
34  {
35  for (unsigned long i = 0; i < capacity; ++i)
36  new (&_array[i]) T();
37  }
38 
39 private:
40  T *_array;
41  unsigned long _capacity;
42 };
43 
44 };
Our C++ library.
Definition: arith:22