C++: Is it better to pass an enum as a value or as a const reference?

后端 未结 5 1015
暗喜
暗喜 2020-12-30 21:41

There are sort of two related questions here:

A) How is enum implemented? For example, if I have the code:

enum myType
{ 
   TYPE_1,
   TYPE_2
};
         


        
5条回答
  •  孤城傲影
    2020-12-30 22:23

    pass built-in simple types (char, short, int, enum, float, pointers) by value

    enums are implemented as integers, you can even explicitly specifiy values for them.

提交回复
热议问题