How to default-initialize local variables of built-in types in C++?

后端 未结 5 757
春和景丽
春和景丽 2021-01-06 20:34

How do I default-initialize a local variable of primitive type in C++? For example if a have a typedef:

typedef unsigned char boolean;//that\'s Microsoft RPC         


        
5条回答
  •  不知归路
    2021-01-06 21:16

    Wrapping in the struct (Boolean) as in your example and accessing via a public member (Boolean::value). It may not be the most elegant solution (some cruft for small benefit), but it similar to what you already showed.

提交回复
热议问题