imperfect C++读书笔记

Chapter 1. Enforcing Design: Constraints, Contracts, and Assertions

本章主要讲的是约束(Constrain)、契约式设计(Design By Contract)和断言(Assertion)。对于每一类都基本上从编译期和运行期两个方面进行说明。
  • 编译期约束
  • 运行期契约
  • 动态断言(运行期)、静态断言(编译期)

编译期约束:

感觉就是在讲如何更进一步对数据类型进行限制,减少错误的发生。文章中主要对几种情况进行了举例:
1)must_have_base()
template<typename Derive,typename Base>
struct must_have_base
{
	~must_have_base()
	{
		void (*p)(Derive*,Base *) = constraints;
	}
private:
	static void constraints(Derive *pd,Base *pb)
	{
		pd = pb;
	}
};


这个函数的工作原理就是强制编译器就检查两个对象指针是不是具有继承关系,否则就会编译出错。

运行期契约:

断言:

动态断言:
静态断言:
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Please revise the paper:Accurate determination of bathymetric data in the shallow water zone over time and space is of increasing significance for navigation safety, monitoring of sea-level uplift, coastal areas management, and marine transportation. Satellite-derived bathymetry (SDB) is widely accepted as an effective alternative to conventional acoustics measurements over coastal areas with high spatial and temporal resolution combined with extensive repetitive coverage. Numerous empirical SDB approaches in previous works are unsuitable for precision bathymetry mapping in various scenarios, owing to the assumption of homogeneous bottom over the whole region, as well as the limitations of constructing global mapping relationships between water depth and blue-green reflectance takes no account of various confounding factors of radiance attenuation such as turbidity. To address the assumption failure of uniform bottom conditions and imperfect consideration of influence factors on the performance of the SDB model, this work proposes a bottom-type adaptive-based SDB approach (BA-SDB) to obtain accurate depth estimation over different sediments. The bottom type can be adaptively segmented by clustering based on bottom reflectance. For each sediment category, a PSO-LightGBM algorithm for depth derivation considering multiple influencing factors is driven to adaptively select the optimal influence factors and model parameters simultaneously. Water turbidity features beyond the traditional impact factors are incorporated in these regression models. Compared with log-ratio, multi-band and classical machine learning methods, the new approach produced the most accurate results with RMSE value is 0.85 m, in terms of different sediments and water depths combined with in-situ observations of airborne laser bathymetry and multi-beam echo sounder.
最新发布
02-18

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值