echelon  0.8.0
vector.hpp
1 // Copyright (c) 2012-2014 Christopher Hinz
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef ECHELON_STD_VECTOR_HPP
7 #define ECHELON_STD_VECTOR_HPP
8 
9 #include <echelon/hdf5/container_adaption.hpp>
10 
11 #include <vector>
12 #include <cassert>
13 
14 namespace echelon
15 {
16 namespace hdf5
17 {
18 
19 template <typename T>
20 inline std::vector<std::size_t> shape(const std::vector<T>& container, adl_enabler)
21 {
22  return {container.size()};
23 }
24 
25 template <typename T>
26 inline void reshape(std::vector<T>& container, const std::vector<std::size_t>& new_shape, adl_enabler)
27 {
28  assert(new_shape.size() == 1);
29 
30  container.resize(new_shape[0]);
31 }
32 
33 }
34 }
35 
36 #endif
echelon&#39;s core namespace
Definition: attribute.cpp:10
auto reshape(C &container, const std::vector< std::size_t > &new_shape) -> decltype(reshape(container, new_shape, adl_enabler
Reshapes the container.
Definition: container_adaption.hpp:64