Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
为派生类专门化 std::hash 在 gcc 中有效,而不是 clang
我正在努力专攻std hash对于派生类 迄今为止最好的方法是基于这个答案 https stackoverflow com a 31213703 620382 include
c
gcc
Clang
c14
sfinae
替换失败是否是依赖非类型模板参数的错误?
假设我有这些模板别名 enum class enabler template
c
templates
C11
sfinae
templatealiases
使用 SFINAE 检测某物是否在(增强)范围内
对于日志记录代码 我想检测模板函数的给定参数是否可以使用以下工具进行迭代升压范围 http www boost org libs range doc html index html或不 显然 无论是否 我都需要实例化不同的代码 所以我需要
c
boost
sfinae
c03
C++ 友元函数模板重载和 SFINAE 在 clang++、g++、vc++ 中的不同行为(C++14 模式)
因此 以下代码在 clang 3 8 0 下构建并成功运行 但在 g 6 3 0 和 vc 19 10 24903 0 下均失败 g 和 vc 都抱怨运算符 的重新定义 有谁知道这里哪个编译器有问题 对于无法编译代码的编译器 编译错误的解决
c
operatoroverloading
sfinae
friendfunction
functiontemplates
如何确定类型是否可以仅使用 const 引用进行调用?
我想写一个 C 元函数is callable
c
templates
C11
templatemetaprogramming
sfinae
decltype 中的表达式是被执行,还是只是被检查以进行验证? [复制]
这个问题在这里已经有答案了 通过使用表达SFINAE https stackoverflow com questions 12654067 what is expression sfinae 你可以检测是否有一些operator https
c
templates
C11
sfinae
使用 SFINAE 在 GCC 和 Clang 上给出不同的结果
我正在学习如何利用 SFINAE 来发挥我的优势 我试图用它来根据是否存在来选择函数实现serialize 对象中的函数 这是我用来确定类型是否定义了 serialize 函数的代码 template
c
gcc
Clang
sfinae
将 std::bind 的结果传递给 std::function “重载”
我有类似的问题在 C 中将不同的 lambda 传递给函数模板 https stackoverflow com questions 40523248 passing different lambdas to function templat
c
c14
templatemetaprogramming
sfinae
void_t 和带有 decltype 的尾随返回类型:它们完全可以互换吗?
考虑以下基于的基本示例void t template
c
templates
sfinae
decltype
C17
使用 SFINAE 的代码可与 GCC 配合使用,但不能与 Clang 配合使用
我正在尝试在 C 11 中使用 SFINAE 来实现序列化库 我的代码可以在 GCC 中正常运行 但不能在 Clang 中运行 我在这里将其简化为最少的代码 template
c
C11
g
sfinae
Clang
如何使用 SFINAE 检测 noexcept 方法
我问的是一个 流行 问题的变体 检测类方法的存在 我在 SO 中读过很多答案 大多数 C 17 后 解决方案看起来像this https stackoverflow com questions 55191505 c compile time
c
templates
Methods
sfinae
noexcept
使用 SFINAE 定义一个要求函数不存在的函数是否可以?
这个问题中的代码基于这个答案 https stackoverflow com a 73307583 4117728 我有点困惑它是如何产生输出的 以及它是否都定义良好 include
c
languagelawyer
sfinae
templateinstantiation
使用 SFINAE 检查全局运算符< [复制]
这个问题在这里已经有答案了 我想要几个重载的 全局的to string 采用某种类型的函数T并将其转换为其字符串表示形式 对于一般情况 我希望能够写 template
c
templates
sfinae
使用 SFINAE 检测相同的类继承
我正在尝试编写一个元函数来检查作为可变参数模板参数传递的所有类型是否不同 似乎执行此操作的最有效方法是从一组类继承并检测是否存在错误 问题是下面的代码编译失败 而我希望 SFINAE 能够工作 Edit 问题不是 如何编写该元函数 而是 如
c
C11
templatemetaprogramming
sfinae
decltype
如何在编译时检查表达式是否非法?
我的应用程序遇到问题 我想断言函数应用程序将被编译器拒绝 有没有办法通过 SFINAE 检查这一点 例如 假设我想验证std transform to a const范围非法 这是我到目前为止所拥有的 include
c
sfinae
typetraits
cconcepts
SFINAE 与 std::enable_if 和 std::is_default_constructible 用于 libc++ 中的不完整类型
当使用 SFINAE 检测模板化类型是否默认可构造时 我刚刚观察到 libc 的一个奇怪问题 以下是我能想到的一个最小示例 include
c
templates
languagelawyer
sfinae
libc
C++11 std 相当于 Boost has_dereference
Boost 的许多 SFINAE 助手已经随 C 11 一起出现在 std 库中 但是has dereference似乎没有 除了这个功能之外 我已经设法从我的包中消除了 Boost 依赖项 并且我想完全摆脱它 那么如何最好地仅使用 C 1
c
C11
boost
sfinae
typetraits
如何从结构中提取索引最高的专业化?
我正在尝试进行一些模板元编程 并且发现需要 提取 某种类型的某种结构的专门化的最高索引 例如 如果我有一些类型 struct A template
c
templates
templatespecialization
templatemetaprogramming
sfinae
具有 SFINAE 虚拟参数的不明确模板
考虑一种需要验证类型的情况T与另一个模板g 可能是一些enable if表达式 例如 在另一个模板的虚拟参数内 如下所示 template
c
templatespecialization
templatemetaprogramming
sfinae
static_assert if 表达式为 constexpr
我想创建一个类模板 template
c
sfinae
typetraits
staticassert
«
1
2
3
4
5
»