首页 > 解决方案 > 为什么默认情况下不是字符串文字 constexpr ?

问题描述

为什么我们不制作所有字符串文字constexpr

constexpr char name[] = "hello";

template < const char* N >
struct T{};

T < name > t;// this works fine
T < "hello" > t1; // this doesn't work

标签: c++c++17

解决方案


推荐阅读