随笔分类 -  c++

cpp tricks
摘要:bcode parser不使用switch实现 B编码中有四种类型:string,integer,dictionary,list。示例分别如下: integer: i43e 表示数字32。 string: 5:world 前面数字表示字符长度为5,字符串为world。 dictionary: d9: 阅读全文
posted @ 2021-12-13 16:40 uttep 阅读(248) 评论(0) 推荐(0)
摘要:#include <iostream> #include <thread> #include <string> #include <vector> #include <memory> #include <algorithm> #include <numeric> #include <random> 阅读全文
posted @ 2021-10-08 14:54 uttep 阅读(166) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> #include <fstream> #include <sstream> #include <map> #include <set> #include <vector> #include <list> #include < 阅读全文
posted @ 2021-09-08 01:10 uttep 阅读(60) 评论(0) 推荐(0)
摘要:使用成员函数指针 Author: David Kieras 原文地址 Using Pointers to Member Functions 翻译 Uttep 成员函数指针不像普通的函数指针,因为成员函数有一个“隐藏的this pointer”,以至于仅仅只能提供一个对象来充当this的作用,使用特殊 阅读全文
posted @ 2021-09-03 11:15 uttep 阅读(272) 评论(0) 推荐(0)
摘要:class A { public: A():aa(42) { std::cout <<"My aaa=> uninitialize:" aaa << std::endl; aaa = aa; std::cout <<"My aaa=> " aaa << std::endl; } private: l 阅读全文
posted @ 2021-08-17 09:39 uttep 阅读(1383) 评论(0) 推荐(0)
摘要:** 详情见注解 #include <iostream> #include <list> #include <map> #include <cstring> #include <iostream> #include <memory> #include <functional> #include <b 阅读全文
posted @ 2021-08-13 14:20 uttep 阅读(53) 评论(0) 推荐(0)
摘要:Linux让你对系统有全面的掌控,这并不是所有人都会这么认为,但是厉害的人都喜欢全面掌控的感觉。我将会向你展示一些基础技巧,这些技巧能极大的影响大多数程序的行为,不仅仅是好玩,而且有用。 一个简单的例子 先玩玩,原理后面再聊。 random_num.c #include <stdio.h> #inc 阅读全文
posted @ 2021-05-13 10:37 uttep 阅读(334) 评论(0) 推荐(0)
摘要:关于inline对链接时的影响 问题: 在分别编译以下代码成目标文件,然后链接成静态库(.a)报错undefined reference.. iusk@wgnmd:~/Documents/Bitusk/testing$ g++ -static testError.o ../src/Error.o / 阅读全文
posted @ 2021-05-05 14:10 uttep 阅读(756) 评论(0) 推荐(0)
摘要:Linux 指定动态链接库路径 问题: 想要指定运行时搜索的动态链接库目录。 g++ -Lpath -llibname 仅仅只能指定好编译时所依赖的库,不能在运行时找到所指定的目录。 解决: g++ -Wl,-rpath,linkpath 可以通过g++来使用linker的命令参数。 g++ -wl 阅读全文
posted @ 2021-03-30 13:38 uttep 阅读(2602) 评论(0) 推荐(0)