- 博客(6)
- 收藏
- 关注
原创 C++ lambda表达式举例与结果
#include <iostream>using namespace std;class Base{public:Base(int x_i,int y_i):x{x_i},y{y_i}{};int Call(){cout << "x := "<< x << '\n';cout << "y := "<< y << '\n';cout << "z := "<< z <<
2020-07-20 10:54:40
1645
原创 C++17 lambda 表达式销毁问题
#include <iostream>using namespace std;class C {private:std::string name;public:void foo() const {auto l1 = [this] { std::cout <<this->name << '\n'; this->print();}; l1();}void print()const{cout << "nice to meet
2020-07-20 09:43:39
737
原创 学习boost::combine 之路
学习boost::combine 之路#include <iostream>#include <boost/range/combine.hpp>#include <boost/optional.hpp>#include <set>using namespace std;int main() { std::set<int> a{1,2}; std::set<int> b{1,3}; auto c=boost::comb
2020-07-09 10:00:55
399
1
原创 C++编译遇到问题记录
#include <optional>#include <iostream>#include <string>using namespace std;int main(){cout<<"hello"<<endl;return 0;}编译使用:gcc -std=c++17 -g optional_changeValue.cpp -o out错误提示:/opt/binutils/x86_64/2.32/bin/ld: opt
2020-06-24 09:37:50
441
原创 template 初探
定义一个基类模板class#include <iostream>using namespace std;template <typename Handler, typename... Names>class Base;int main() { cout<<"hello"<<endl; return 0;}result:hello2.
2020-06-08 16:15:46
143
原创 boost库里boost::optional
//source code#include #include <boost/optional.hpp>#include using namespace std;int main() {std::vector<int> temp{1};auto out = boost::make_optional(temp);if(out == boost::none){ std::cout<<"boost::none"<<std::endl;}else
2020-06-04 16:01:56
410
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人