![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
haohaibo031113
这个作者很懒,什么都没留下…
展开
-
srand()和rand()
srand(n)函数用来设定随机数的种子 rand()函数用来产生随机数 参考: http://blog.csdn.net/zqy2000zqy/article/details/1174978原创 2017-05-23 20:29:37 · 253 阅读 · 0 评论 -
struct构造函数
struct PRE{ int* pre; int count; PRE():count(0) { }};原创 2017-06-07 21:34:16 · 466 阅读 · 0 评论 -
C/C++ strtok
函数原型 char *strtok(char s[], const char *delim);分解字符串为一组字符串。s为要分解的字符串,delim为分隔符字符串。 例如:strtok(“abc,def,ghi”,”,”),最后可以分割成为abc def ghi.尤其在点分十进制的IP中提取应用较多。#include <iostream>#include <string.h>#inclu原创 2017-07-03 12:24:49 · 296 阅读 · 0 评论 -
C++11 unordered_set
template < class Key, // unordered_set::key_type/value_type class Hash = hash<Key>, // unordered_set::hasher class Pred = equal_to<Key>, //原创 2017-07-05 12:36:34 · 374 阅读 · 0 评论 -
C++ STL unique函数
先sort 在调用unique 参数: http://www.cnblogs.com/heyonggang/archive/2013/08/07/3243477.html原创 2017-07-09 20:38:15 · 498 阅读 · 0 评论 -
C++ 字符串分割
参考: https://www.cnblogs.com/MikeZhang/archive/2012/03/24/MySplitFunCPP.html原创 2017-08-16 17:00:14 · 262 阅读 · 0 评论 -
C语言中可变参数的函数
参考: https://www.cnblogs.com/engraver-lxw/p/7225232.html原创 2017-08-10 18:58:33 · 276 阅读 · 0 评论 -
C++ namespace
C++ 命名空间假设这样一种情况,当一个班上有两个名叫 Zara 的学生时,为了明确区分它们,我们在使用名字之外,不得不使用一些额外的信息,比如他们的家庭住址,或者他们父母的名字等等。 同样的情况也出现在 C++ 应用程序中。例如,您可能会写一个名为 xyz() 的函数,在另一个可用的库中也存在一个相同的函数 xyz()。这样,编译器就无法判断您所使用的是哪一个 xyz() 函数。 因此,引入了原创 2017-07-27 16:24:19 · 191 阅读 · 0 评论 -
C++ 理解#include如何工作
g++ -I -H -I选项指定头文件搜索路径 -H指示编译器输出包含文件的路径 参考: https://docs.oracle.com/cd/E19205-01/820-1210/bjadq/index.html http://blog.csdn.net/chosen0ne/article/details/7210946原创 2017-07-27 17:03:23 · 202 阅读 · 0 评论 -
C++ regex
C++ regex正则表达式的规则和其他语言差不多,如下:特殊字符(用于匹配很难形容的字符) characters description matches \d digit a decimal digit character注意: 在C++中反斜杠(\)会转义std::regex e1("\\d"); // \d -> 匹配数字字符std::regex e2("\\\\"原创 2017-08-13 16:43:45 · 402 阅读 · 0 评论 -
C++11 Defaulted 和 Deleted 函数
参考:C++11 标准新特性:Defaulted 和 Deleted 函数原创 2017-08-20 20:09:05 · 268 阅读 · 0 评论 -
C++ 文件读写
#include <fstream> ofstream //文件写操作 内存写入存储设备 ifstream //文件读操作,存储设备读入到内存中 fstream //读写操作,对打开的文件可进行读写操作 参考: C++文件读写详解(ofstream,ifstream,fstream)原创 2017-08-13 21:05:53 · 341 阅读 · 0 评论 -
string.reserve 与 string.resize的区别
参考: string.reserve 与 string.resize的区别原创 2017-08-21 18:00:12 · 470 阅读 · 0 评论 -
C++函数名后加const
把类成员函数声明为const,表明该成员函数不修改类对象参考: http://blog.csdn.net/beyondhaven/article/details/3490209原创 2017-08-22 20:52:15 · 482 阅读 · 0 评论 -
C++ 参考手册
参考:http://zh.cppreference.com/w/cpp原创 2017-08-22 23:13:14 · 1031 阅读 · 0 评论 -
gcc-4.8.4编译C++11多线程代码出现的问题
hhb@lambda:chapter2$ g++ --std=c++11 list_2.8.cpp出现下面错误:hhb@lambda:chapter2$ ./a.outhardware_threads = 48num_threads = 48terminate called after throwing an instance of 'std::system_error' what():原创 2017-05-30 22:08:17 · 1221 阅读 · 0 评论 -
C++并发参考资料
C++ Concurrency in Action Practical Multithreading https://www.manning.com/books/c-plus-plus-concurrency-in-action并发编程网 http://ifeve.com/c-plus-plus-concurrency-in-action/#header原创 2017-05-20 22:18:30 · 280 阅读 · 0 评论 -
MPI学习资料
参考: http://blog.csdn.net/baimafujinji/article/category/6411216原创 2017-05-21 22:01:56 · 341 阅读 · 0 评论 -
并行计算学习资料
https://docs.loni.org/wiki/Introduction_to_OpenMP#Objectives https://software.intel.com/zh-cn/blogs/2009/04/20/openmp-2 http://www.openmp.org/resources/tutorials-articles/ https://computing.llnl.gov原创 2017-05-21 11:59:27 · 710 阅读 · 0 评论 -
C++ boost thread组件, 编译
编译遇到的的问题 http://blog.csdn.net/ivan_ljf/article/details/70808579原创 2017-05-22 16:20:47 · 885 阅读 · 0 评论 -
C++ explicit关键字
通过将构造函数声明为explicit(显式)的方式可以抑制隐式转换。也就是说,explicit构造函数必须显式调用。参考: http://blog.csdn.net/chollima/article/details/3486230原创 2017-05-29 21:51:07 · 182 阅读 · 0 评论 -
C++ std::mem_fn
这个相当于STL中内置的仿函数,可以使用调取STL容器内对象的内置函数; mem_fn最为人所熟知的作用是,将一个成员函数作用在一个容器上,就像这样std::for_each(v.begin(), v.end(), boost::mem_fn(&Shape::draw))就可以让容器vector中的每一个元素都执行一遍draw方法。 第二个用法是,它可以帮助把一个函数指针模拟得像一个函数实体原创 2017-05-30 19:21:47 · 1018 阅读 · 0 评论 -
C++ std::advance给迭代器增加指定偏移量
template <class InputIterator, class Distance> void advance (InputIterator& it, Distance n);迭代器辅助函数。 使迭代器it偏移n,其中n为整数。#include <iostream> // std::cout#include <iterator> // std::advance#in原创 2017-05-30 21:43:45 · 3358 阅读 · 0 评论 -
gcc对C++ Standards的支持
Gcc4.8.1第一完全实现了C++11标准C++11 Support in GCCGCC 4.8.1 was the first feature-complete implementation of the 2011 C++ standard, previously known as C++0x.This mode can be selected with the -std=c++11 comma原创 2017-05-30 22:34:57 · 451 阅读 · 0 评论 -
install gcc locally without root privileges
参考: https://luiarthur.github.io/gccinstall https://stackoverflow.com/questions/23708385/installing-gcc-4-9-without-root-adding-paths-and-binaries-and-extra原创 2017-05-30 22:51:19 · 659 阅读 · 0 评论 -
C/C++ const总结
const是C++中的常量修饰符,即所修饰的对象为常量(immutable) 常量类型的变量或对象的值是不能被更新的 参考: http://blog.csdn.net/Eric_Jo/article/details/4138548 http://blog.csdn.net/sddzycnqjn/article/details/7289712原创 2017-06-04 17:50:10 · 244 阅读 · 0 评论 -
C++ 模板
C++ 模板应用非常广泛,有必要学习下 C++ 的标准库提供许多有用的函数大多结合了模板的观念,如STL以及IO Stream。模板的声明形式如下:template <class identifier> function_declaration;template <typename identifier> function_declaration;github代码: https://githu原创 2017-06-01 11:04:48 · 256 阅读 · 0 评论 -
C++11 智能指针
参考: https://www.cnblogs.com/lanxuezaipiao/p/4132096.html原创 2017-06-05 16:20:37 · 206 阅读 · 0 评论 -
C++11参考资料
http://www.bogotobogo.com/cplusplus/C11/原创 2017-05-20 22:28:25 · 256 阅读 · 0 评论 -
C++ 基础知识
getline函数 在中的getline函数有四种重载形式: istream& getline (istream& is, string& str, char delim);istream& getline (istream&& is, string& str, char delim);istream& getline (istream& is, string& str原创 2017-05-21 00:42:50 · 330 阅读 · 0 评论 -
C语言malloc多维数组
利用二级指针申请一个二维数组#include<stdio.h> #include<stdlib.h> int main() { int **a; //用二级指针动态申请二维数组 int i,j; int m,n; printf("请输入行数\n"); scanf("%d",&m); printf("请输入列数\n"原创 2017-05-21 10:26:59 · 1293 阅读 · 0 评论 -
C++ 模板 decltype关键字 RTTI机制
参考: C++中的RTTI机制 C++11特性:decltype关键字 C++中模板使用详解 C++ 模板详解(一)原创 2017-08-15 23:24:57 · 391 阅读 · 0 评论