Home > other >  C - during the declaration will value initialized to two-dimensional vector
C - during the declaration will value initialized to two-dimensional vector

Time:09-27

I have announced my two-dimensional array. But for this reason lead to error

The vector & lt; The vector & lt; int> Plain (vector & lt; int> 23,43,45,56 (4, 0))={{},
,85,13,59 {67},
48,23,9,57 {},
24,52,90,12 {}};


Rijndael. CPP: 12:51 p.m. : error: expected ', 'or'; 'before'='token
Rijndael. CPP: 57:1: error: expected '} 'at the end of the input

All previous half colon are correctly allocated. Can you tell me where the declaration of mistakes?
I deleted the constructor calls, and now my statement is

The vector & lt; The vector & lt; int> Plain/* (vector & lt; int> (4, 0)) */={{23,43,45,56},
,85,13,59 {67},
48,23,9,57 {},
24,52,90,12 {}};

But now the error is

Rijndael. CPP: bowing: error: in c + + 98 'plain' must be initialized by the constructor, not by '{... }
'Rijndael. CPP: bowing: error: deducing the from brace - enclosed, initializer list the requires # include & lt; Initializer_list & gt;
Rijndael. CPP: bowing: error: deducing the from brace - enclosed, initializer list the requires # include & lt; Initializer_list & gt;
Rijndael. CPP: bowing: warning: extended, initializer lists only the available with - STD=c + + 0 x or - STD=gnu++ 0 x
Rijndael. CPP: bowing: error: could not convert '{{23, 43, 45, 56}, {13, 67, 85, 59}, {9, 48, 23, 57}, {24, 52, 90, 12}}' to 'STD: : vector '

How do I correct this? Appreciate any form of help.

CodePudding user response:

You can't have constructor calls at the same time and a list of initialization, adherence to the one, for example:

vector 23,43,45,56 plain {{},
,85,13,59 {67},
48,23,9,57 {},
24,52,90,12 {}};

(you can omit=list for initialization.)
Error in your editor: well, explains everything, will help you read it. You need to 11 C model initialization list. If you don't want to do this, you must use ctor replicate to prepare for a 2 d array, and then fill out after the build.

CodePudding user response:

This problem solved??
  • Related