I have below a structure and need to initialize the object of it using std::fill
.
typedef struct _test
{
char name[32];
char key[4];
int count;
}test;
As of now, I am using memset
. I need to change it to std::fill
. I have tried below but std::fill
throws compiler error for the structure object.
test t;
char a[5];
std::fill(a, a + 5, 0);
std::fill(t, sizeof(t), 0);
Note: I don't want to initialize using this way. char a[5] = {0};