voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
vector.hpp
1 #ifndef BLUB_CORE_VECTOR_HPP
2 #define BLUB_CORE_VECTOR_HPP
3 
4 #include "blub/core/globals.hpp"
5 #include "blub/serialization/access.hpp"
6 #include "blub/serialization/nameValuePair.hpp"
7 
8 #include <boost/serialization/base_object.hpp>
9 #include <boost/serialization/vector.hpp>
10 
11 #include <vector>
12 
13 
14 namespace blub
15 {
16 
17 
18  template <typename T>
19  class vector : public std::vector<T>
20  {
21  public:
22  typedef std::vector<T> t_base;
23 
24  vector() {;}
25  vector(const std::size_t& size)
26  : t_base(size)
27  {
28  }
29  vector(const std::size_t& size, const T& value)
30  : t_base(size, value)
31  {
32  }
33 #if !defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST || BOOST_CLANG == 1
34  vector(const std::initializer_list<T> &list)
35  : t_base(list)
36  {
37  }
38 #endif
39  protected:
40  BLUB_SERIALIZATION_ACCESS
41  template<typename Archive>
42  void serialize(Archive & ar, const unsigned int version)
43  {
44  (void)version;
45  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(t_base); // TODO remove boost macro, use blub
46  }
47  };
48 
49  template <typename T>
50  std::ostream& operator<< (std::ostream& ostr, const vector<T>& toCast)
51  {
52  ostr << "{";
53  for (const T& elem : toCast)
54  {
55  ostr << elem << ",";
56  }
57  return ostr << "}";
58  }
59 
60 }
61 
62 
63 #endif // BLUB_CORE_VECTOR_HPP
Definition: vector.hpp:19
Definition: deadlineTimer.hpp:10
Definition: list.hpp:13