In a type trait, why do people use enum rather than static const for the value?

前端 未结 5 1870
别那么骄傲
别那么骄傲 2021-02-04 02:28

For example, this is how I would write it, and it compiles and works just fine:

template struct is_pointer {
  static const bool valu         


        
5条回答
  •  面向向阳花
    2021-02-04 03:31

    It also is another symbol in every object file that includes it, to no benefit. If you use symbol folding (--gc-sections) you'll run out of separatable sections & bloat your binary.

提交回复
热议问题