1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#include <array>
class mydata
{
std::array<std::array<int, 2>, 5> bi_dataM;
public:
void filldataM()
{
const std::array<std::array<int, 2>, 5> localdataLC
{ 1, 2, 3, 4, 5, 5, 4, 3, 2, 1 }; // brace elision
bi_dataM = localdataLC;
const std::array<std::array<int, 2>, 5> localdataLC2
{ { {{1,2}}, {{3,4}}, {{5,5}}, {{4,3}}, {{2,1}} } }; // fully braced
bi_dataM = localdataLC2;
}
// initialise in constructor (fully braced)
mydata() : bi_dataM { { {{1,2}}, {{3,4}}, {{5,5}}, {{4,3}}, {{2,1}} } } {}
// initialise in constructor (brace elision)
mydata(int) : bi_dataM { 1, 2, 3, 4, 5, 5, 4, 3, 2, 1 } {}
};
|