Cplusplus
春呜
123
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
模板函数实例化学习
#include<iostream> #include <string.h> using namespace std; template <typename T, typename F> void Test(T t, F fun) { static int i = 0; i++; cout << fun(t) <<" "<<i<<endl; } double Double(double d) { return d原创 2020-05-24 16:02:58 · 318 阅读 · 0 评论 -
C++ 类变量初始化顺序
#include<iostream> using namespace std; class Base { public: Base(int a) : Ba(a) {} public: int Ba; }; class Derived: public Base { public: int Db; int Dc; // 初始化的顺序和变量定义的顺序相同,依次初始化Ba,Db,Dc Derived(int b, int c) : Dc(c), Base(b), Db(Ba + Dc .原创 2020-05-20 22:44:34 · 282 阅读 · 0 评论 -
C++ 类地址空间学习
#include <iostream> using std::cout; using std::endl; class Base1 { public: Base1() :a_(100) {} virtual void fun1() { cout << "Base1.fun1" << endl; } virtual void fun2() { cout ...原创 2020-03-01 20:47:34 · 411 阅读 · 0 评论 -
auto类型推导和类型打印
这里的代码参考了如下内容: effective modern c++ https://stackoverflow.com/questions/81870/is-it-possible-to-print-a-variables-type-in-standard-c/56766138#56766138 #include <iostream> #include <type_traits...原创 2020-02-22 23:36:03 · 2477 阅读 · 0 评论 -
C++格式化输出相关
#include <iostream> #include <iomanip> using namespace std; int main() { cout << "格式化进制" << endl; long num = 1001; // 不同进制输出, 不支持二进制;八进制和十六进制目前仅支持正整数 cout << "dec: ...原创 2020-02-15 18:07:59 · 182 阅读 · 0 评论 -
c++继承学习
#include <iostream> using namespace std; class Base { public: virtual void fun() { cout << "I am base" << endl; } }; class Derived :public Base { public: void fun() override { c...原创 2020-01-16 13:00:24 · 183 阅读 · 0 评论 -
boost库的thread_pool学习
一、boost库版本 Version 1.69.0 二、boost库安装 下载源码boost_1_69_0.tar.bz2 解压安装: ./bootstrap.sh; ./b2 install 三、牛刀小试 #include <stdio.h> #include <string.h> #include <iostream> #include ...原创 2019-03-17 22:21:20 · 2466 阅读 · 0 评论 -
C++ std::function 模板类学习笔记
以下内容来自于: http://en.cppreference.com/w/cpp/utility/functional/function 对例子进行了相应修改,用于学习更多的细节Class template std::function is a general-purpose polymorphic function wrapper. Instances of std::function ca...翻译 2018-05-13 15:39:57 · 4034 阅读 · 0 评论 -
constexpr specifier
转载自: constexpr specifierconstexpr - specifies that the value of a variable or function can appear in constant expressionsExplanationThe constexpr specifier declares that it is possible to evaluate the...转载 2018-04-05 18:16:59 · 705 阅读 · 0 评论 -
C++ bind 函数学习笔记
#include <iostream> #include <functional> #include <string> using namespace std; bool lenLargethanLen(const string &s, string::size_type sz) { return s.length() > sz; } in...原创 2018-04-01 22:58:22 · 612 阅读 · 0 评论 -
lambda表达式学习
lambda表达式的基本形式,如下:[capture list] (params list) [key word: mutuble] ->return type { func body }说明:(1) [capture list]里面的内容具体形式如下:(2)params list 输入参数,这个和普通的函数一样(3)keyword:mutuble:默认情况下,lambda表达式不会改变一...原创 2018-04-01 16:21:52 · 586 阅读 · 0 评论
分享