David W
David W

Reputation: 121

Assign values to first row of matrix in C++

I am very new to C++ programming and I am trying to figure out a concise way to assign values to the first row of an matrix. I am using the boost c++ library. The following is a small snippet of my code that I believe is necessary to illustrate my problem.

#include "boost/multi_array.hpp"
typedef boost::multi_array<double, 2> matrix;
matrix T_zone(boost::extents[2000][10])

I want to assign the first row of the T_zone matrix the value of 400. I realize I could do this with a for loop, but is there a better way? Like in python, I could easily set the first row of the array with T_zone[0] = 400.

Upvotes: 1

Views: 792

Answers (1)

Ambitions
Ambitions

Reputation: 2581

No. You can not do it with a single line of code. You have to use a for loop. Correct me if I am wrong.

Upvotes: 1

Related Questions