diaolingle
码龄13年
关注
提问 私信
  • 博客:86,747
    社区:3,742
    90,489
    总访问量
  • 38
    原创
  • 1,600,923
    排名
  • 6
    粉丝
  • 0
    铁粉
IP属地以运营商信息为准,境内显示到省(区、市),境外显示到国家(地区)
IP 属地:广东省
  • 加入CSDN时间: 2011-12-25
博客简介:

diaolingle的专栏

查看详细资料
个人成就
  • 获得16次点赞
  • 内容获得3次评论
  • 获得59次收藏
创作历程
  • 52篇
    2016年
  • 1篇
    2015年
  • 1篇
    2013年
成就勋章
TA的专栏
  • Windows编程
    1篇
  • C/C++
    21篇
  • MFC编程
  • 数据库编程
  • 算法
    3篇
  • libcurl
  • socket编程
    6篇
  • mysql
    1篇
  • 数据结构
    1篇
  • others
    1篇
  • linux多线程
    1篇
  • linux多进程
    1篇
  • 模板
    1篇
  • stl的使用
    12篇
  • Lua
    1篇
创作活动更多

开源数据库 KWDB 社区征文大赛,赢取千元创作基金!

提交参赛作品,有机会冲刺至高2000元的创作基金,快来参与吧!

去参加
  • 最近
  • 文章
  • 代码仓
  • 资源
  • 问答
  • 帖子
  • 视频
  • 课程
  • 关注/订阅/互动
  • 收藏
搜TA的内容
搜索 取消

lua保留n位小数方法

本文转载至http://www.cnblogs.com/pk-run/p/4444582.html1. string.format()function GetPreciseDecimal(nNum, n) if type(nNum) ~= "number" then return nNum; end n = n or
转载
发布博客 2016.08.18 ·
7382 阅读 ·
0 点赞 ·
0 评论 ·
1 收藏

设置函数环境——setfenv

文章转载至: http://www.cnblogs.com/sifenkesi/p/3843348.html 当我们在全局环境中定义变量时经常会有命名冲突,尤其是在使用一些库的时候,变量声明可能会发生覆盖,这时候就需要一个非全局的环境来解决这问题。setfenv函数可以满足我们的需求。  setfenv(f, table):设置一个函数的环境  (1)当第一个参数为一个
转载
发布博客 2016.08.18 ·
463 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

右值引用

http://www.cnblogs.com/hujian/archive/2012/02/13/2348621.html
原创
发布博客 2016.05.15 ·
467 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

multimap用法

#include #include #include #include using namespace std;int main(int argc, char** argv){ multimap mmap; mmap.insert(pair(1, 1)); mmap.insert(pair(1, 2)); mmap.insert(pair(2, 3)); multimap:
原创
发布博客 2016.05.14 ·
1621 阅读 ·
1 点赞 ·
0 评论 ·
0 收藏

list的用法,基本把所有成员试了一遍

#include #include #include using namespace std;bool RemoveOdd(const int& val){ return val % 2;}struct Desc : public binary_function{ result_type operator()(first_argument_type _Left, secon
原创
发布博客 2016.05.14 ·
469 阅读 ·
0 点赞 ·
0 评论 ·
1 收藏

单向队列queue的使用

#include #include #include using namespace std;int main(int argc, char** argv){ //deque没有迭代器,stack也没有,因此都不能排序 //deque插入元素只能从尾部插入,弹出智能从头部弹出 //创建单向队列 queue q; printf("size(): %d
", q.size()
原创
发布博客 2016.05.14 ·
1488 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

deque的用法

#include #include #include using namespace std;class GreaterComp : public binary_function{public: result_type operator()(first_argument_type& _Left, second_argument_type& _Right) { return _
原创
发布博客 2016.05.14 ·
529 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

stack的使用

#include #include #include using namespace std;int main(int argc, char** argv){ stack s; //返回栈顶元素 //printf("top(): %d
", s.top()); //出错 //检测栈是否为空 printf("empty(): %d
",s.empty()); //从栈
原创
发布博客 2016.05.14 ·
353 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

stl set的用法

#include #include #include #include using namespace std;struct GreaterComp : public binary_function{ result_type operator()(first_argument_type& _Left, second_argument_type& _Rigth) { retur
原创
发布博客 2016.05.14 ·
328 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

vector的使用

#include #include #include using namespace std;int main(int argc, char** argv){ vector ivec; //想vector尾部插入元素,返回void ivec.push_back(1); ivec.push_back(11); ivec.push_back(12); //得到首元素和尾元素
原创
发布博客 2016.05.14 ·
341 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

hash_map的用法续

如果要在hash_map中把自已定义的类作为key的话要怎么做?这种情况下需要定义计算自定义的hash函数和比较自定义类的比较函数#include #include #include using namespace std;class A{public: A(int a, int b) : m_a(a), m_b(b) {} A(const A& a) { prin
原创
发布博客 2016.05.13 ·
1424 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

hash_map的使用

例子:#include #include #include using namespace std;int _tmain(int argc, _TCHAR* argv[]){ hash_map hm; //插入元素 for (int i = 0; i < 10; i++) hm.insert(make_pair(i, i)); //正序输出 hash_map::i
原创
发布博客 2016.05.13 ·
701 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

map容器的一些方法说明

#include #include #include #include using namespace std;int _tmain(int argc, _TCHAR* argv[]){ map dmap; dmap.insert(pair(3, 1)); dmap.insert(pair(4, 1)); dmap.insert(pair(5, 1)); dmap.inse
原创
发布博客 2016.05.12 ·
2059 阅读 ·
1 点赞 ·
0 评论 ·
0 收藏

map容器的erase用法

删除指定map中指定key的元素:#include #include #include #include using namespace std;int _tmain(int argc, _TCHAR* argv[]){ map dmap; dmap.insert(pair(3, 1)); dmap.insert(pair(4, 1)); dmap.insert(pair
原创
发布博客 2016.05.12 ·
1473 阅读 ·
1 点赞 ·
0 评论 ·
3 收藏

map容器的insert用法总结

例子:#include #include #include #include using namespace std;int _tmain(int argc, _TCHAR* argv[]){ map imap; map jmap; jmap[1] = 1; jmap[2] = 2; imap.insert(jmap.begin(), jmap.end()); m
原创
发布博客 2016.05.12 ·
18456 阅读 ·
2 点赞 ·
1 评论 ·
14 收藏

杂项

Q: #include 和 #include “...”的区别?A:前者优先在库Include路径中搜索,后者优先在项目Include路径中搜索.Q:C++中, extern "C" 在哪些情况下会被用到,作用是什么?A: 因为C++的函数重载等特征,会在编译时在函数名称前后添加修饰符(取决于实现), 这一点与C语言不兼容. 用 extern "C" 修饰后的函数
原创
发布博客 2016.05.12 ·
269 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

shared_ptr的线程安全性

shared_ptr 的线程安全级别和内建类型、标准库容器、std::string 一样,即:• 一个 shared_ptr 对象实体可被多个线程同时读取;• 两个 shared_ptr 对象实体可以被两个线程同时写入,“析构”算写操作;• 如果要从多个线程读写同一个 shared_ptr 对象,那么需要加锁;请注意,以上是 shared_ptr 对象本身的线程安全
转载
发布博客 2016.05.11 ·
505 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

shared_ptr的用法

先看一个例子:#include #include #include using namespace std;class A{public: A() { printf("A constructor
"); } ~A() { printf("A destructor
"); } void Print() { printf("This is A
"); }};
原创
发布博客 2016.05.11 ·
640 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

operator new和operator delete

1. 为什么要重载 operator new ?答: 效率问题: 通常系统默认提供的分配器速度极慢, 而且分配小型对象时空间浪费严重.改变行为:默认的分配器失败时会抛出异常, 或许你想改变这种行为.2. operator new 的行为答:区分三个不同的 new:      new 操作符(new 表达式, new operator, new expression):
转载
发布博客 2016.05.11 ·
1345 阅读 ·
0 点赞 ·
0 评论 ·
0 收藏

关于指针的删除

先上一个例子:#include #include #include #include using namespace std;int _tmain(int argc, _TCHAR* argv[]){ char* dst = "This is a str"; char* str = (char*)malloc(strlen(dst) + 1); if (str == NUL
原创
发布博客 2016.05.11 ·
1919 阅读 ·
2 点赞 ·
0 评论 ·
1 收藏
加载更多