If the values are known at compile time
float d1[4] = {1.0f, 2.0f, 3.0f, 4.0f};
or
std::array<float, 4> d1 {1.0f, 2.0f, 3.0f, 4.0f}; // since C++11
The simple way is, assuming values are generated at run time,
std::array<float, 4> d1; // or float d1[4]
for (int i = 0; i < 4; ++i) d1[i] = i+1.0f;
// or, instead of the loop, since C++11
std::iota(std::begin(d1), std::end(d1), 1.0f); // iota() specified in <numeric>
or (if the number of elements is not known until run time)
std::vector<float> d1(number);
for (int i = 0; i < number; ++i) d1[i] = i+1.0f;
// or, instead of the loop, since C++11
std::iota(d1.begin(), d1.end(), 1.0f);