![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++基础
peter ren
这个作者很懒,什么都没留下…
展开
-
c++ new
一. new(type*)class();含义是什么? 实验如下:#include <iostream> // std::coutint main () { int *x = new int(5); int* p = new(x)int(10); std::cout<<"x:"<<x<<std::endl; std::cout<<"p:"<<p<<std原创 2016-01-08 12:30:31 · 266 阅读 · 0 评论 -
c++模板特化
模板的特化分为两类:函数模板的特化和类模板的特化。 (1) 函数模板的特化:当函数模板需要对某些类型进行特别处理,称为函数模板的特化。例如:#include <iostream>#include <string.h>using namespace std;template<class T>bool isBigger(T t1, T t2){ return t1 > t2;}t原创 2016-07-01 14:17:59 · 305 阅读 · 0 评论 -
g++ 支持c11、c14的方法
//第一种,直接包含在源程序文件中,如第一行代码所示#pragma GCC diagnostic error "-std=c++14"#include <iostream>using namespace std;int main(int argc,char **argv){ cout<<"hello world!"<<endl; auto i=11; cout<<i<原创 2017-02-09 14:29:58 · 3681 阅读 · 2 评论