简体   繁体   中英

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;
};
 

As Daniel Langr mentioned time_struct_() does the job.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM