- 博客(20)
- 资源 (2)
- 收藏
- 关注
原创 C++ 实现BitMap
C++ 实现BitMap#include <cstdint>class BitMap {private: uint64_t* m_arr; const int32_t RADIX = 64; const int32_t R_SHILT = 6; uint64_t m_maxValue;public: BitMap(uint64_t max_value) : m_maxValue(max_value){ uint32_t b
2022-01-16 23:27:46
411
转载 cmake 支持boost
cmake_minimum_required(VERSION 2.8)project(test)SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11")find_package(Boost REQUIRED COMPONENTS regex#filesystem )if(NOT Boost_FOUND) message("...
2018-08-05 00:43:25
1097
原创 boost 字符串与文本处理 -> lexical_cast
lexical_cast P178示例代码 #include <boost/lexical_cast.hpp> int main() { using namespace boost; int x = lexical_cast<int>("100"); long y = lexical_cast<long>("2000");
2017-03-03 10:32:50
407
原创 boost库uuid工具
uuid P161可以自定义一个头文件来使用uuid组件//uuids.hpp #include <boost/uuid/uuid.hpp>#include <boost/uuid/uuid_generators.hpp>#include <boost/uuid/uuid_io.hpp>using namespace boost::uuids;#include "uuids.hpp"usin
2017-03-02 15:50:41
541
原创 boost::exception
boost::exception 异常 P151 #include <boost/exception/all.hpp> using namespace boost; 代码 #include <string> #include <boost/exception/all.hpp> using namespace boost; struct my_exceptio
2017-03-01 16:15:35
689
原创 boost 实用工具
1. noncopyable P1102. typeof P1123. optional P1164. assign5. swap6. singleton 单件模式7. boost.serialzation 单件模式8. tribool --基于三态的布尔逻辑9. operators P140
2017-02-27 16:38:03
306
原创 boost pool库
一. pool库 -> pool P100返回一个简单数据类型(POD)的内存指针,如int、double等. #include <boost/pool/pool.hpp> using namespace boost; int main() { pool<> pl(sizeof(int)); //一个可分配int的内存池
2017-02-27 15:05:46
267
原创 boost smart_prt 4-> shared_ptr
shared_ptr P84引用计数型的智能指针 shared_ptr spi(new int); assert(spi); *spi = 253; shared_ptr sps(new string(“smart”)); assert(sps->size() == 5);shared_ptr提供operator<比较操作符,可用于标准关联容器 #include <iostre
2017-02-26 12:00:10
537
原创 boost smart_ptr 3-> scoped_array
scoped_array P82 scoped_array 类似scoped_ptr,封装了new[]操作符,为动态数组提供了一个代理 scoped_array<int> sa(new int[100]); sa[0] = 10; *(sa+1) = 20; 除非对性能有非常苛刻的要求,或者编译器不支持标准库,否则不建议使用scoped_array.
2017-02-26 11:28:01
251
原创 boost smart_ptr -> scoped_ptr
smart_ptr 库概述 C++98 校准的“自动指针”:std::auto_ptr #include <boost/smart_ptr.hpp> using namespace boost; scoped_ptr P78 只能在本作用域内使用,不希望被转让。a. 不支持比较操作 b. .swap()交换两个scoped_ptr保存的原始指针,高效操作。sc
2017-02-25 12:36:26
386
原创 boost 时间与日期
要点一、timer库 P33timer #include <boost/timer.hpp>using namespace boost;progress_timer P36 继承自timer,析构时自动输出时间 #include <boost/progress.hpp>using namespace boost;//将progress_timer的输出转移到时stringst
2017-02-24 14:36:01
403
原创 boost::assert学习笔记
P213要点头文件 #include assert.hpp> 默认情况下BOOST_ASSERT宏等同于assert宏,断言表达式为真,即: #define BOOST_ASSERT(expr) assert(expr)。如果参数expr表达式值为true,那么断言成立,程序会继续向下执行,否则断言会引发一个异常。BOOST_ASSERT宏仅会在debug模式下生效。
2017-02-24 13:59:33
2096
原创 boost::format常用用法
p167 头文件#include <boost/format.hpp>using namespace boost;一个简单的例子#include <boost/format.hpp>using namespace boost;int main(){ cout<< format("%s:%d+%d=%d\n")%"sum"%1%2%(1+2); format fmt("(%1
2017-02-22 16:01:30
1589
翻译 MFC 单文档标题栏菜单按钮重绘
1、在MainFrame中实现 OnMeasureItem和OnDrawItem函数void CMainFrame::OnMeasureItem( int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct ){ // TODO: 在此添加消息处理程序代码和/或调用默认值 lpMeasureItemStruct->itemWidth = ::G
2016-03-30 15:41:50
2125
原创 20160301 常用AFX函数
函数名称说明AfxAbort 无条件地终止一应用程序;通常在不可恢复错误发生时调用AfxBeginThread创建新的线程并开始执行它AfxEndThread终止当前执行的线程AfxMessageBox 显示Windows消息框 AfxGetApp 返回执行应用程序对象的指针AfxGetAppName
2016-03-01 11:39:18
550
转载 欢迎使用优快云-markdown编辑器
欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl
2016-03-01 11:28:49
274
转载 ADO连接SQLServer数据库的连接字
1. 标准方式 ================================================ oConn.Open "Provider=sqloledb;" & _ "Data Source=myServerName;" & _
2013-12-15 13:04:52
1615
转载 VC 线程编程
转载于 程序风云在用VC6.0写程序调试时,初学者总是会遇到一些错误,针对如下错误主要是因为MFC类库没有引用所出现的问题。错误现象:nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadexnafxcwd.lib(thrdcore.obj) : erro
2013-11-20 17:12:27
381
原创 关于sprintf_s第二个参数的用法
int sprintf( char *buffer, const char *format, [ argument] … );int sprintf_s(char *buffer,size_t sizeOfBuffer,const char *format [,argument] ...);sprintf_s第二个参数包含一个NULL字符,比
2013-10-31 10:21:41
2362
1
AnkhSvn-2.5.
2014-06-13
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人