Questions about code intent
Static Variables
The code below will create in every implementation file (every .cxx
file) its own set of static variables. Hence, server/PythonAssimilator.cxx
and server/Assimilator.cxx
have their own copies of these variables. Is this intended?
namespace py {
static PyObject *pFunc;
static PyObject *pModule;
static wchar_t *program;
static PyObject *pEnsemble_list_background;
static PyObject *pEnsemble_list_analysis;
static PyObject *pEnsemble_list_hidden_inout;
static PyObject *pArray_assimilated_index;
static PyObject *pArray_assimilated_varid;
sum_vec
Why not std::accumulate(vector.cbegin(), vector.cend(), 0)
? man std::accumulate
/// sums over a vector
template <class T>
T sum_vec(const std::vector<T> &vec) {
T res = 0;
for (auto &it : vec) {
res += it;
}
return res;
}
Edited by Christoph Conrads