- 博客(16)
- 资源 (1)
- 收藏
- 关注
原创 boost::function与回调函数
boost::function与回调函数这是我在学习陈硕muduo网络库过程中记录的关于C++的知识碎片,对muduo感兴趣的同学可以加入QQ群365972535一起讨论:利用 boost::function 存储 普通函数、类成员函数、函数对象,实现函数回调的功能#include <iostream> #include <boost/bind.hpp> #include <boost/functi
2016-07-24 23:31:54 1850
原创 boost::ptr_vector
boost::ptr_vector这是我在学习陈硕muduo网络库过程中记录的关于C++的知识碎片,对muduo感兴趣的同学可以加入QQ群365972535一起讨论:boost::ptr_vector 官网例子代码/home/chenzw/jmuduo/tests/ptr_vector.cc #include <boost/ptr_container/ptr_vector.hpp> #include
2016-07-24 14:50:37 1057
原创 explicit与类类型转换
P263 C++中我们也能为类定义隐式转换规则,如果构造函数只接受一个参数,则它实际上定义了转换为此类类型的隐式转换机制,也称为转换构造函数。p514 我们同样能定义对于类类型的类型转换,通过定义类型转换运算符可以做到这一点,转换构造函数和类型转换运算符共同定义了类类型转换。#include <cstdio>class SmallInt { public: SmallInt(
2016-07-16 14:36:27 396
原创 设计模式之c++实现(三)
工厂方法模式工厂方法模式定义一个创建产品对象的工厂接口,将实际创建工作推迟到子类当中。 核心工厂类不负责产品的创建,成为一个抽象角色,仅负责具体工厂子类必须实现的接口。 实现了可扩展。factory.h#ifndef __FACTORY_H_ #define __FACTORY_H_#include "simplefactory.h"class FactoryBase { public:
2016-07-13 20:05:39 425
原创 设计模式之c++实现(二)
简单工厂模式实验环境 Ubuntu14.04 简单工厂模式是由一个工厂对象(Factory)决定创建出哪一种产品(Product)的实例#ifndef __SIMPLEfACTORY_H_ #define __SIMPLEfACTORY_H_#include <stdio.h> #include <string> #include <assert.h>class CarBase { public:
2016-07-13 19:53:39 705
原创 MongoDB c++ driver(七)
MongoDB c++ driver(七)查找实现(四)#include <iostream>#include <mongocxx/client.hpp> #include <mongocxx/instance.hpp>#include <bsoncxx/builder/stream/document.hpp> #include <bsoncxx/json.hpp>using bsoncxx::bu
2016-07-03 17:55:58 1040
原创 ubuntu14.04 cuda8.0 GTX1080 环境搭建
cuda8.0安装于ubuntu14.04+GTX1080网上似乎比较少cuda8.0的环境搭建博客,本人也倒腾了几天,分享下。服务器重装ubuntu系统后,接上独立显卡,频率太高,黑屏 切换成集显,安装ssh apt-get install ssh 切换独显,在另一台电脑用xshell登陆服务器To verify that your GPU is CUDA-capable, go to yo
2016-07-03 16:03:03 4768 8
原创 MongoDB c++ driver(六)
MongoDB c++ driver(六)查找实现(三)#include <iostream>#include <bsoncxx/builder/stream/document.hpp> #include <bsoncxx/json.hpp>#include <mongocxx/client.hpp> #include <mongocxx/options/find.hpp> #include <mo
2016-07-03 15:17:44 799
原创 MongoDB c++ driver(五)
MongoDB c++ driver(五)查找实现(二)#include <iostream>#include <bsoncxx/builder/stream/document.hpp> #include <bsoncxx/json.hpp>#include <mongocxx/client.hpp> #include <mongocxx/options/find.hpp> #include <mo
2016-07-03 15:05:13 601
原创 MongoDB c++ driver(四)
MongoDB c++ driver(四)简单的查找实现#include <iostream>#include <bsoncxx/builder/stream/document.hpp> #include <bsoncxx/json.hpp>#include <mongocxx/client.hpp> #include <mongocxx/options/find.hpp> #include <mo
2016-07-03 14:44:43 1703
原创 MongoDB c++ driver(三)
插入数据(二)多种常用数据插入的写法#include <chrono> #include <sys/time.h>// #include <bsoncxx/types.hpp> #include <bsoncxx/builder/stream/document.hpp> #include <bsoncxx/json.hpp>#include <mongocxx/client.hpp> #includ
2016-07-03 11:47:39 1666
原创 MongoDB c++ driver(二)
插入数据#include <mongocxx/client.hpp> #include <mongocxx/instance.hpp> #include <mongocxx/client.hpp> #include <mongocxx/instance.hpp>#include <bsoncxx/builder/stream/document.hpp> #include <bsoncxx/json.
2016-07-03 11:38:27 916
原创 MongoDB c++ driver(一)
连接数据库#include <mongocxx/client.hpp> #include <mongocxx/instance.hpp>int main(int argc, char** args) { mongocxx::instance inst{}; //chenzw:123 -->用户:密码 参考上一篇博客 mongocxx::client conn{mon
2016-07-03 11:27:39 1398 1
原创 MongoDB用户创建
MongoDB用户创建打开mongo服务 $ sudo ./mongodb/bin/mongod –dbpath ./m17/ –logpath ./mlog/m17.log –fork –port 27017 打开mongo客户端 $ ./mongodb/bin/mongo –port 27017 MongoDB shell version: 3.2.6 connecting
2016-07-03 10:27:22 843
原创 MongoDB C++ 开发环境搭建
编译使用C++ MongoDB Driver本博客在linux下编译使用C++ MongoDB Driver准备工作 GCC 4.8.2+ CMake 3.2+ The MongoDB C driver version 1.3.5+ boost 1.56+ 编译安装MongoDB C DriverThe C++ driver uses libbson and the MongoDB C drive
2016-07-02 23:10:50 1876
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人