Search code examples
c++structinitializer-listc++98

How to initialize tm struct memebers in initializer list of a structure in C++ 98 standard


I'm trying to initialize ::tm struct's members in a structure using initializer list as shown below. But it's only possible in C++ stds > 98.

How can I achieve the same in C++ 98?

struct abc {
    abc () : time_struct_{0,0,0,0,0,0,0,0,0}, x(0) { }
    ::tm time_struct_ ;
    int x;
};
 

Solution

  • As Daniel Langr mentioned time_struct_() does the job.