10 #ifndef TEUCHOS_VECTOR_HPP
11 #define TEUCHOS_VECTOR_HPP
14 #include <Teuchos_Assert.hpp>
22 inline int size(std::vector<T>
const& v) {
27 inline typename std::vector<T>::reference at(std::vector<T>& v,
int i) {
28 TEUCHOS_DEBUG_ASSERT(0 <= i);
29 TEUCHOS_DEBUG_ASSERT(i <
int(v.size()));
30 return v[std::size_t(i)];
34 inline typename std::vector<T>::const_reference at(std::vector<T>
const& v,
int i) {
35 TEUCHOS_DEBUG_ASSERT(0 <= i);
36 TEUCHOS_DEBUG_ASSERT(i <
int(v.size()));
37 return v[std::size_t(i)];
41 inline void resize(std::vector<T>& v,
int n) {
42 TEUCHOS_DEBUG_ASSERT(0 <= n);
43 v.resize(std::size_t(n));
47 inline void reserve(std::vector<T>& v,
int n) {
48 TEUCHOS_DEBUG_ASSERT(0 <= n);
49 v.reserve(std::size_t(n));
53 inline std::vector<T> make_vector(
int n, T
const& init_val = T()) {
54 return std::vector<T>(std::size_t(n), init_val);
58 void add_back(std::vector<T>& vector, T& value) {
60 vector.push_back(T());
61 swap(vector.back(), value);