Using boost multi_array and its views in the same function

时间:2016-07-11 20:51:57

标签: c++ boost boost-multi-array

A multi_array view has many of the same methods as a multi_array. Do they have a common base that I can use by reference?

void count(Type a) {
//         ^^^^ what should I use here?
    cout << a.num_elements() << endl;
}

int main() {
    boost::multi_array<int, 2> a;
    count(a);
    count(a[indices[index_range()][index_range()]]);
}

1 个答案:

答案 0 :(得分:0)

不,没有共同基础。你必须使用模板。查看MultiArray ConceptThe Boost Concept Check Library