大佬教程收集整理的这篇文章主要介绍了c – constexpr lambda /’x’没有命名类型;你的意思是’x’?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
#include <utility> template <char...> struct str { constexpr auto operator==(const str&) const { return true; } void foo() const; }; template <typename S,std::size_t... Ns> constexpr auto make_str(S s,std::index_sequence<Ns...>) { return str<s()[Ns]...>{}; } #define LIT(s) \ make_str([]() { return s; },std::make_index_sequence<sizeof(s) - 1>{}) constexpr auto x = LIT("hansi"); constexpr auto y = x; static_assert(x == y);
x.foo();
使用来自trunk(g(GCC)7.0.0 20161102)的当前gcc,我收到以下错误消息:
c.cpp:19:1: error: ‘x’ does not name a type; did you mean ‘x’? x.foo();
有关演示,请参见https://godbolt.org/g/uN25e1
以上是大佬教程为你收集整理的c – constexpr lambda /’x’没有命名类型;你的意思是’x’?全部内容,希望文章能够帮你解决c – constexpr lambda /’x’没有命名类型;你的意思是’x’?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。