IFEM 90A354
readIntVec.h
Go to the documentation of this file.
1//==============================================================================
11//==============================================================================
12
13#ifndef _READ_INT_VEC_H
14#define _READ_INT_VEC_H
15
16#include <fstream>
17#include <vector>
18#include <string>
19
20typedef std::vector<int> IntVec;
21
22
27static IntVec readIntVector (const std::string& file)
28{
29 std::ifstream f(file);
30 size_t size;
31 f >> size;
32 if (!f) size = 0;
33 IntVec result(size);
34 for (int& i : result) f >> i;
35 return result;
36}
37
38#endif
std::vector< int > IntVec
General integer vector.
Definition ASMbase.h:25
std::vector< int > IntVec
General integer vector.
Definition readIntVec.h:20
static IntVec readIntVector(const std::string &file)
Reads an integer array from a named file, for unit testing.
Definition readIntVec.h:27