吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 254|回复: 0
收起左侧

[求助] tuple支持CTAD但是还是没有推导模板参数

[复制链接]
xihahaNextYear 发表于 2024-8-16 02:00
[Asm] 纯文本查看 复制代码
import <tuple>;
import <iostream>;
import <string>;
import  <tuple>

using namespace std;

template<typename TupleType, int n>
class TuplePrintHelper
{
public:
    TuplePrintHelper(const TupleType& t)
    {
        TuplePrintHelper<TupleType, n - 1> tp{ t };
        cout << get<n - 1>(t) << endl;
    }
};

template<typename TupleType>
class TuplePrintHelper<TupleType, 0>
{
public:
    TuplePrintHelper(const TupleType&){}
};

template<typename T>
void tuplePrint(const T& t)
{
    TuplePrintHelper<T, tuple_size<T>::value> tph{ t };
};

int main()
{
    tuple t1{167, "Testaa"s,false, 2.3 };
    tuplePrint(t1);
}



tuple不是支持CTAD吗 为什么还是会报无法推导模板参数
test.png

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-9-21 11:27

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表