template-argument-deduction

template-argument-deduction

文章 0 浏览 6

扣除在类模板中声明的朋友函数的模板参数

考虑以下示例: #include template struct S { friend int Func(T) // decl-1 { return V; } }; struct U { friend int Func(U); // decl-2 }; templa…

北恋 2025-02-13 23:06:59 1 0

是否有一种干净的方法将模板参数转发到模板函数?

但是,以下作用是 #include template double func1(B x, B y) { A a = 3.0f; return a + x + y; } template double func2() { B x = 5.0; B y = 8.0; …

偏闹i 2025-02-13 06:15:56 0 0

类模板参数扣除类,并带有其他非类型参数

在这种情况下,是否可以使CTAD适用于 t ? enum class boundary_type:int{inclusive, exclusive}; template struct interval { using value_type = T;…

野鹿林 2025-02-12 05:40:34 0 0

扣除模板功能很少

我几乎没有一个模板功能的实例。他们每个人都依次执行每个给定的lambdas,并伴随着特定的消息。当我用一个lambda做到这一点时,一切都很好,但是当我…

醉南桥 2025-02-10 15:30:34 1 0

使用C+++ 23在编译器资源管理器上的23个功能期望

我在youtube上观看了一个C ++ con视频,发现在这里。 我对这些新概念感兴趣。我尝试从幻灯片27和29的代码片段 @23:00- @26:30实现。我的代码有一个…

别再吹冷风 2025-02-09 07:00:37 2 0

具有专业类型的功能扣除指南

我有一些这样的代码 template return_type f(param1_type p1, shared_ptr, E) { // param1_type A B C D E used here // returns type return_type } …

把回忆走一遍 2025-02-08 06:57:26 1 0

基于结构的参数的类模板扣除指南

当将模板结构用作另一个模板结构的参数时,我会遇到一些自动模板扣除失败的条件。如何为这三个条件编写推力指南? #include #include template struct…

套路撩心 2025-02-06 13:25:11 1 0

显示当前(隐性)扣除指南

我有以下这个问题中的错误消息,类别的类模板指南基于基于参数。 :44:8: error: template parameters not deducible in partial specialization: 44 |…

青柠芒果 2025-02-06 11:07:15 1 0

为什么提供无参数函数模板时,编译器会尝试推论?

template struct X { static_assert(sizeof...(T) != 0); }; template void f(const X &) {} template void inner() {} int main() { f(inner); } 在…

还在原地等你 2025-02-05 17:31:41 1 0

复杂的模板涉及constexpr以及更多

我试图在编写复杂的模板上变得更好。我选择了一个示例问题,其中我替换了std :: setw,std :: setfill和std :: hex,hex有些不同。 (注意:这个问题…

雨巷深深 2025-02-04 18:56:44 1 0

在C+&#x2B中进行函数模板的指南扣除。

在任何人说这个问题是重复的之前,我检查了另一个问题,这对我不满意。这不是我想要的。 是否可以为功能模板具有参数扣除指南吗? 如果是,那怎么样?…

神魇的王 2025-02-02 23:55:22 2 0

std ::函数与可呼叫作为模板参数

在下面的示例中,为什么第20行会导致第27行到30行描述的错误? 在第33行中调用 exec1 正常工作。 #include #include #include #include #include temp…

巴黎夜雨 2025-02-02 23:37:08 3 0

如何从元组中提取类型列表的struct/class

我想在类中使用静态方法,该方法在 std :: tuple< t1,t2,t3,...> 中获取类型列表。我不想使用 std :: tuple< ...> 我想拥有< …

北方。的韩爷 2025-01-27 07:37:54 2 0

如何获取C+ 11中依赖功能指针模板参数的第一个参数的类型?

当前代码: #include template std::pair f(T * const t) { // ... return std::make_pair(t, D); // need `T` and `D` here } void d(int *t); void …

喵星人汪星人 2025-01-24 13:07:17 3 0

C++ 17中的部分类模板参数扣除

在下面的示例中,我们使用C ++ 17功能“类模板参数扣除”来推断 val 是类型 base< int,double,double,bool> : template struct Base { Ba…

眼眸里的那抹悲凉 2025-01-23 11:07:59 4 0
更多

推荐作者

李珊平

文章 0 评论 0

Quxin

文章 0 评论 0

范无咎

文章 0 评论 0

github_ZOJ2N8YxBm

文章 0 评论 0

若言

文章 0 评论 0

南…巷孤猫

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文