constexpr,string_view和查找

问题描述

我刚刚编写了以下代码

bool is_name_char(char c)
{
    using namespace std::string_view_literals;
    constexpr const auto not_name = "[]<>/("sv;
    constexpr const auto b = std::begin(not_name);
    constexpr const auto e = std::end(not_name);
    return (e == std::find(b,e,c)) && (0x21 <= c && c <= 0x7e);
}

(如果未列入黑名单,则该函数应该接受[0x21,0x7e]范围内的字符)。

在Visual Studio 2019(@版本16.7.2)中调试此代码会使VS抱怨be不是来自同一序列。

在这里一个错误的假设,还是应该这样做?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)