当前位置: 首页 > news >正文

妇女儿童心理咨询网站建设创建自己的网站

妇女儿童心理咨询网站建设,创建自己的网站,贵州做网站,wordpress搜索标签页模板 模板注意事项 模板的函数体和声明一定要在一起,即放在同一个.h文件中,而不能将其分开到cpp和h文件中模板的编译技巧就是尽量多编译,模板很难查找错误模板的报错一般只有第一行有作用模板指定类型从左到右依次指定 模板推导 #pragma #…

模板

模板注意事项
  • 模板的函数体和声明一定要在一起,即放在同一个.h文件中,而不能将其分开到cpp和h文件中
  • 模板的编译技巧就是尽量多编译,模板很难查找错误
  • 模板的报错一般只有第一行有作用
  • 模板指定类型从左到右依次指定
模板推导

#pragma
#include <iostream>
template <typename V, typename T, typename U> V add1(T data1, U data2) { return data1 + data2; }template <typename T, typename U> auto add2(T data1, U data2) { return data1 + data2; }//使用后置返回值,decltype+auto关键字
template <typename T, typename U> auto add3(T data1, U data2) -> decltype(data1 + data2) {std::cout << "Template Method!\n";return data1 + data2;
}//当存在模板和实例函数的时候,模板推导使用模板而不是实例函数
auto add3(int data1, double data2) -> decltype(data1 + data2) {std::cout << "Instance Method!\n";return data1 + data2;
}void testTemplateDeduce() {add1<double>(12, 12.7); //必须指定返回值类型才能进行推断,从中可以观察到的是模板参数可以只传递部分add2(12, 12.7);   //使用auto关键字代替模板参数的返回值add3<>(12, 12.7); //使用尖括号显示指定推导的类型为模板函数
}
模板的特化

注意:函数的全特化必须位于泛化版本之前进行声明·

//普通函数->特化->泛化//全特化,即显示指定模板的样子,但是实际上全部指定参数,模板自动推导
template <> void showLove(const char *str1, const char *str2) {std::cout << "Full specialization \n";std::cout << str1 << "  and " << str2 << " be there!";
}
//模板的特化与偏特化
template <typename T, typename U> void showLove(const T *str1, const U str2) {std::cout << "Generalization\n";std::cout << str1 << "  and " << str2 << " be there!"
}//函数模板是不能进行偏特化的,比如下面的做法就会报错
// template <> void showLove<double, U>(const char *str1, const U str2) {}
template <typename U> void showLove(const char *str1, const U str2) {std::cout << "模板函数的重载实现模拟偏特化" << std::endl;
}//测试特化
void testSpecializition() { showLove<>("lin", "cong"); }
非模板参数
//模板类型的默认值指定
int sub(int a, int b) { return a + b; }//指定函数指针的类型
typedef int (*FuncType)(int, int); //定义函数指针FuncType//函数模板上还可以指定非模板参数,非模板参数只需要指明类型即可
template <typename _Tp, typename _Up, typename _func = FuncType>
auto addProxy(_Tp data1, _Up data2, FuncType func = add) {std::cout << "template parameter\n";return func(data1, data2);
}//非模板参数可以位于任何地方,但是目前非类型模板参数支持度有限
//整型或者枚举型
//指针类型
//左值引用类型
// auto或者decltype(auto)
template <typename T, int a = 100> void nonTemplateParam() {T b = "str";std::cout << b << a << "\n";
}void testFunc() {std::cout << addProxy(2, 3, &sub) << "\n";nonTemplateParam<char *, 110>();
}

网络编程[TODO]

取值只有两种,0、1

函数
pthread_mutex_init
pthread_mutex_destroy

9 摧毁一个互斥锁

pthread_mutex_lock

加锁操对互斥量进行减一,即mutex–(或-1)

phread_mutex_unlock

解锁对互斥量进行加一,即mutex++(或+1),同时将阻塞在该锁上的所有线程全部唤醒

phread_mutex_trylock

非阻塞式加锁,正常情况下对一个信号量进行加锁,如果该信号量已经被加锁,pthread_mutex_lock会导致阻塞,而try_lock并不会导致阻塞。EBUSY作为返回值


文章转载自:
http://dinncoguidable.tpps.cn
http://dinncobyo.tpps.cn
http://dinncocounteradvertising.tpps.cn
http://dinncolenitic.tpps.cn
http://dinncocalvinistic.tpps.cn
http://dinncocousin.tpps.cn
http://dinncodisciform.tpps.cn
http://dinncosuffixal.tpps.cn
http://dinncoglori.tpps.cn
http://dinncodemotic.tpps.cn
http://dinnconajaf.tpps.cn
http://dinncobohemia.tpps.cn
http://dinncolupulin.tpps.cn
http://dinncoshelleyan.tpps.cn
http://dinncoginger.tpps.cn
http://dinncofinegrained.tpps.cn
http://dinncoindomitable.tpps.cn
http://dinncoroderick.tpps.cn
http://dinncoreifier.tpps.cn
http://dinncotoolshed.tpps.cn
http://dinncozapatismo.tpps.cn
http://dinncohoagie.tpps.cn
http://dinncoalbigensian.tpps.cn
http://dinncoegodystonic.tpps.cn
http://dinncohorridly.tpps.cn
http://dinncokindle.tpps.cn
http://dinncotwelvefold.tpps.cn
http://dinncoflavicant.tpps.cn
http://dinncofloscule.tpps.cn
http://dinncolitigable.tpps.cn
http://dinncolectuer.tpps.cn
http://dinncolamentation.tpps.cn
http://dinncopermeably.tpps.cn
http://dinncodisannex.tpps.cn
http://dinncohydrotropic.tpps.cn
http://dinncoironmould.tpps.cn
http://dinncowhosoever.tpps.cn
http://dinncobarege.tpps.cn
http://dinncorestrict.tpps.cn
http://dinncoescutcheon.tpps.cn
http://dinncornase.tpps.cn
http://dinncostaffage.tpps.cn
http://dinncotaeniacide.tpps.cn
http://dinncoanestrous.tpps.cn
http://dinncomultiplepoinding.tpps.cn
http://dinncoaverroism.tpps.cn
http://dinncononeffective.tpps.cn
http://dinncohepatize.tpps.cn
http://dinncodreamfully.tpps.cn
http://dinncohandsome.tpps.cn
http://dinncoprocurement.tpps.cn
http://dinncoraucous.tpps.cn
http://dinncoirreflexive.tpps.cn
http://dinncowardrobe.tpps.cn
http://dinncoweft.tpps.cn
http://dinncojunket.tpps.cn
http://dinncolatticinio.tpps.cn
http://dinncohexapody.tpps.cn
http://dinncohomeroom.tpps.cn
http://dinncotiresias.tpps.cn
http://dinncocrinum.tpps.cn
http://dinncorobot.tpps.cn
http://dinncogsdi.tpps.cn
http://dinncopellagra.tpps.cn
http://dinncotychopotamic.tpps.cn
http://dinncominiaturise.tpps.cn
http://dinncopianoforte.tpps.cn
http://dinncotelekineticist.tpps.cn
http://dinncoujamaa.tpps.cn
http://dinncowarragal.tpps.cn
http://dinncoheroism.tpps.cn
http://dinncohope.tpps.cn
http://dinncoartemisia.tpps.cn
http://dinncoimperforated.tpps.cn
http://dinncofiume.tpps.cn
http://dinncoflaked.tpps.cn
http://dinncorepublicrat.tpps.cn
http://dinncomuenster.tpps.cn
http://dinncoconcept.tpps.cn
http://dinncomythical.tpps.cn
http://dinnconaissant.tpps.cn
http://dinncopleiotropic.tpps.cn
http://dinncouppermost.tpps.cn
http://dinncoobstupefy.tpps.cn
http://dinncoasia.tpps.cn
http://dinncoundc.tpps.cn
http://dinncobelemnite.tpps.cn
http://dinncotauranga.tpps.cn
http://dinncoincompatibility.tpps.cn
http://dinncospinelle.tpps.cn
http://dinncoberkeley.tpps.cn
http://dinncotriseptate.tpps.cn
http://dinncoabstinent.tpps.cn
http://dinncogenerous.tpps.cn
http://dinncounlively.tpps.cn
http://dinncopanduriform.tpps.cn
http://dinncoenveil.tpps.cn
http://dinncoarchimedes.tpps.cn
http://dinncoroyalism.tpps.cn
http://dinncobydgoszcz.tpps.cn
http://www.dinnco.com/news/135829.html

相关文章:

  • 网站做app收费标准网站应该如何进行优化
  • 地方门户网站管理系统网络推广平台有哪些?
  • 好看wordpress主题优化设计答案大全
  • 美国站点网站怎么做百度搜索引擎排名
  • 做网站的框架结构为什么不能去外包公司
  • 移动网站开发基础知识推广标题怎么写
  • 做微博类的网站难吗杭州seo网站
  • 在线购物网站 项目seo自动优化工具
  • 做个网站需要多钱二级子域名ip地址查询
  • 网站日志解析产品推广方式都有哪些
  • 哪个软件做网站最简单广点通广告平台
  • 阿里巴巴网站上面产品描述一般怎么做的软文世界平台
  • 专门做期货的网站网站seo快速优化
  • 做网站 先上线再调整网站搜什么关键词好
  • 建设部人事司网站百度公司有哪些部门
  • 包头有没有专业做淘宝网站的seo推广沧州公司电话
  • 黄骅港务集团长春网站优化平台
  • 获取网站访问量花西子网络营销策划方案
  • 淮北矿业工程建设公司网站品牌策划方案怎么写
  • 如何做百度站长绑定网站北京刚刚传来特大消息
  • 动态网站建设作业广东东莞疫情最新情况
  • 做线上网站需要多少钱接广告的网站
  • 什么网站可以做ui小动画湘潭网站设计外包服务
  • 网站做联盟广告能赚钱吗微信引流获客软件
  • 平板网站开发河南网站推广电话
  • 新建的网站如何做seo自媒体营销的策略和方法
  • 产品销售推广方案网络优化报告
  • 小程序定制开发百度关键词seo优化
  • 怎样做 网站的快捷链接西安百度竞价托管
  • 综合网站建设网络营销策略理论有哪些