Integrate type name in static_assert output?

后端 未结 5 962
独厮守ぢ
独厮守ぢ 2020-12-04 18:56

I like to give helpful errors / messages, and I also want to do so for my static_asserts. The problem is, that they depend on template parameters. Normally, tho

5条回答
  •  感动是毒
    2020-12-04 19:36

    It's possible to get a string literal passed in as a template non-type parameter, with a little bit of hoop-jumping. But since the second argument to static_assert is constrained to be a string literal rather than, say, an address constant expression, this unfortunately is not much use.

    Sadly I suspect your best bet is to lobby the committee or the compiler writers to extend the facility.

提交回复
热议问题