Why are type_traits implemented with specialized template structs instead of constexpr?

后端 未结 5 1838
别跟我提以往
别跟我提以往 2021-01-12 00:40

Is there any reason why the standard specifies them as template structs instead of simple boolean constexpr?

In an additional question that

5条回答
  •  我在风中等你
    2021-01-12 01:15

    One reason is that the type_traits proposal is older than the constexpr proposal.

    Another one is that you are allowed to add specializations for your own types, if needed.

提交回复
热议问题