我用C++20写了个方便调试代码的库!有兴趣的可以去看看哦!特别好用
  • 板块灌水区
  • 楼主iamputin
  • 当前回复12
  • 已保存回复12
  • 发布时间2022/12/19 17:22
  • 上次更新2023/10/24 07:11:57
查看原帖
我用C++20写了个方便调试代码的库!有兴趣的可以去看看哦!特别好用
722677
iamputin楼主2022/12/19 17:22

仓库地址在这里哦

这个库花了我好多心思,功能个人感觉是挺不错的

这是示例代码

#include "debug.hpp"
#include <bits/stdc++.h>

int main() {

    std::cout << "=========Without type=========" << std::endl;
    std::vector<std::string> strs {"Hello", ",", " world!"};
    debug(strs);
    std::tuple<int, double, std::vector<std::string>> tup(114514, 3.1415926535897, strs);
    debug(tup);
    std::map<std::string, int> m { {"China", 1}, {"America", 2}, {"Russia", 3} };
    debug(m);
    bool ok = true;
    debug(ok);
    std::cout << "==============================" << std::endl;
    std::cout << std::endl;
    std::cout << "=========With type=========" << std::endl;
    debug_with_type(strs);
    debug_with_type(tup);
    debug_with_type(m);
    debug_with_type(ok);
    std::cout << "==============================" << std::endl;
}

下面是输出

=========Without type=========
strs = ["Hello", ",", " world!"]
tup = (114514, 3.1415926535897, ["Hello", ",", " world!"])
m = {"America": 2, "China": 1, "Russia": 3}
ok = true
==============================

=========With type=========
std::vector<std::string> strs = ["Hello", ",", " world!"]
std::tuple<int, double, std::vector<std::string>> tup = (114514, 3.1415926535897, ["Hello", ",", " world!"])
std::map<std::string, int> m = {"America": 2, "China": 1, "Russia": 3}
bool ok = true
==============================

如果觉得好用的话不妨为我留下个star哦!详细的信息在仓库介绍里面

如果有问题也可以在github上给我提issue,我会第一时间处理的~

2022/12/19 17:22
加载中...