- 浏览: 213367 次
- 性别:
- 来自: 北京
-
文章分类
最新评论
-
zhuchao_ko:
有用的废话。。。
架构与产品 -
450029462:
java学好了 c++其实也不难,就是 宏多点 内存控制多点 ...
从java转向C\c++开发要学会些什么 -
ldlzagg:
...
启示2013 -
raojl:
书是买了, 一直没时间捣鼓!
我发现开始喜欢Python了 -
raojl:
回过头看了看也不全然对啊,呵呵!
IT行业发展‘VIA’模式探讨
1、版本编译控制(比如多项目)
2、编译校验
3、static_cast
----------------------------------------------------------
// static_check.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <string> using namespace std; namespace Loki { //////////////////////////////////////////////////////////////////////////////// // Helper structure for the STATIC_CHECK macro //////////////////////////////////////////////////////////////////////////////// template<int> struct CompileTimeError; template<> struct CompileTimeError<true> {}; } //////////////////////////////////////////////////////////////////////////////// // macro STATIC_CHECK // Invocation: STATIC_CHECK(expr, id) // where: // expr is a compile-time integral or pointer expression // id is a C++ identifier that does not need to be defined // If expr is zero, id will appear in a compile-time error message. //////////////////////////////////////////////////////////////////////////////// #define STATIC_CHECK(expr, msg) \ { Loki::CompileTimeError<((expr) != 0)> ERROR_##msg; (void)ERROR_##msg; } int _tmain(int argc, _TCHAR* argv[]) { STATIC_CHECK((sizeof(int) == 4 && sizeof(long) == 4), 32bit); STATIC_CHECK((sizeof(int) != sizeof(long)), 64bit); return 0; }
////////////////////////////////////////////////////////////////////////////////
// The Loki Library // Copyright (c) 2001 by Andrei Alexandrescu // This code accompanies the book: // Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design // Patterns Applied". Copyright (c) 2001. Addison-Wesley. // Permission to use, copy, modify, distribute and sell this software for any // purpose is hereby granted without fee, provided that the above copyright // notice appear in all copies and that both that copyright notice and this // permission notice appear in supporting documentation. // The author or Addison-Welsey Longman make no representations about the // suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. //////////////////////////////////////////////////////////////////////////////// // Last update: November 22, 2001 #ifndef TYPEMANIP_INC_ #define TYPEMANIP_INC_ namespace Loki { //////////////////////////////////////////////////////////////////////////////// // class template Int2Type // Converts each integral constant into a unique type // Invocation: Int2Type<v> where v is a compile-time constant integral // Defines 'value', an enum that evaluates to v //////////////////////////////////////////////////////////////////////////////// template <int v> struct Int2Type { enum { value = v }; }; //////////////////////////////////////////////////////////////////////////////// // class template Type2Type // Converts each type into a unique, insipid type // Invocation Type2Type<T> where T is a type // Defines the type OriginalType which maps back to T //////////////////////////////////////////////////////////////////////////////// template <typename T> struct Type2Type { typedef T OriginalType; }; //////////////////////////////////////////////////////////////////////////////// // class template Select // Selects one of two types based upon a boolean constant // Invocation: Select<flag, T, U>::Result // where: // flag is a compile-time boolean constant // T and U are types // Result evaluates to T if flag is true, and to U otherwise. //////////////////////////////////////////////////////////////////////////////// template <bool flag, typename T, typename U> struct Select { typedef T Result; }; template <typename T, typename U> struct Select<false, T, U> { typedef U Result; }; //////////////////////////////////////////////////////////////////////////////// // class template IsSameType // Return true iff two given types are the same // Invocation: SameType<T, U>::value // where: // T and U are types // Result evaluates to true iff U == T (types equal) //////////////////////////////////////////////////////////////////////////////// template <typename T, typename U> struct IsSameType { enum { value = false }; }; template <typename T> struct IsSameType<T,T> { enum { value = true }; }; //////////////////////////////////////////////////////////////////////////////// // Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big) //////////////////////////////////////////////////////////////////////////////// namespace Private { template <class T, class U> struct ConversionHelper { typedef char Small; struct Big { char dummy[2]; }; static Big Test(...); static Small Test(U); static T MakeT(); }; } //////////////////////////////////////////////////////////////////////////////// // class template Conversion // Figures out the conversion relationships between two types // Invocations (T and U are types): // a) Conversion<T, U>::exists // returns (at compile time) true if there is an implicit conversion from T // to U (example: Derived to Base) // b) Conversion<T, U>::exists2Way // returns (at compile time) true if there are both conversions from T // to U and from U to T (example: int to char and back) // c) Conversion<T, U>::sameType // returns (at compile time) true if T and U represent the same type // // Caveat: might not work if T and U are in a private inheritance hierarchy. //////////////////////////////////////////////////////////////////////////////// template <class T, class U> struct Conversion { typedef Private::ConversionHelper<T, U> H; #ifndef __MWERKS__ enum { exists = sizeof(typename H::Small) == sizeof((H::Test(H::MakeT()))) }; #else enum { exists = false }; #endif enum { exists2Way = exists && Conversion<U, T>::exists }; enum { sameType = false }; }; template <class T> struct Conversion<T, T> { enum { exists = 1, exists2Way = 1, sameType = 1 }; }; template <class T> struct Conversion<void, T> { enum { exists = 0, exists2Way = 0, sameType = 0 }; }; template <class T> struct Conversion<T, void> { enum { exists = 0, exists2Way = 0, sameType = 0 }; }; template <> struct Conversion<void, void> { public: enum { exists = 1, exists2Way = 1, sameType = 1 }; }; //////////////////////////////////////////////////////////////////////////////// // class template SuperSubclass // Invocation: SuperSubclass<B, D>::value where B and D are types. // Returns true if B is a public base of D, or if B and D are aliases of the // same type. // // Caveat: might not work if T and U are in a private inheritance hierarchy. //////////////////////////////////////////////////////////////////////////////// template <class T, class U> struct SuperSubclass { enum { value = (::Loki::Conversion<const volatile U*, const volatile T*>::exists && !::Loki::Conversion<const volatile T*, const volatile void*>::sameType) }; }; //////////////////////////////////////////////////////////////////////////////// // class template SuperSubclassStrict // Invocation: SuperSubclassStrict<B, D>::value where B and D are types. // Returns true if B is a public base of D. // // Caveat: might not work if T and U are in a private inheritance hierarchy. //////////////////////////////////////////////////////////////////////////////// template<class T,class U> struct SuperSubclassStrict { enum { value = (::Loki::Conversion<const volatile U*, const volatile T*>::exists && !::Loki::Conversion<const volatile T*, const volatile void*>::sameType && !::Loki::Conversion<const volatile T*, const volatile U*>::sameType) }; }; } // namespace Loki //////////////////////////////////////////////////////////////////////////////// // macro SUPERSUBCLASS // Invocation: SUPERSUBCLASS(B, D) where B and D are types. // Returns true if B is a public base of D, or if B and D are aliases of the // same type. // // Caveat: might not work if T and U are in a private inheritance hierarchy. // Deprecated: Use SuperSubclass class template instead. //////////////////////////////////////////////////////////////////////////////// #define SUPERSUBCLASS(T, U) \ ::Loki::SuperSubclass<T,U>::value //////////////////////////////////////////////////////////////////////////////// // macro SUPERSUBCLASS_STRICT // Invocation: SUPERSUBCLASS(B, D) where B and D are types. // Returns true if B is a public base of D. // // Caveat: might not work if T and U are in a private inheritance hierarchy. // Deprecated: Use SuperSubclassStrict class template instead. //////////////////////////////////////////////////////////////////////////////// #define SUPERSUBCLASS_STRICT(T, U) \ ::Loki::SuperSubclassStrict<T,U>::value //////////////////////////////////////////////////////////////////////////////// // Change log: // June 20, 2001: ported by Nick Thurn to gcc 2.95.3. Kudos, Nick!!! // November 22, 2001: minor change to support porting to boost // November 22, 2001: fixed bug in Conversion<void, T> // (credit due to Brad Town) // November 23, 2001: (well it's 12:01 am) fixed bug in SUPERSUBCLASS - added // the volatile qualifier to be 100% politically correct // September 16, 2002: Changed "const volatile" to "const volatile *", to enable // conversion to succeed. Done earlier by MKH. // Added SuperSubclass and SuperSubclassStrict templates. The corresponding // macros are deprecated. // Added extra parenthesis in sizeof in Conversion, to disambiguate function // call from function declaration. T.S. //////////////////////////////////////////////////////////////////////////////// #endif // TYPEMANIP_INC_
发表评论
-
服务端口快扫shell
2014-08-25 11:50 715#set -x var_start=8000 arra ... -
远程批量部署
2014-07-29 11:50 627#!/usr/bin/expect -- if ... -
linux 下建立异步链接
2014-05-07 11:59 563int32_t SockEndPoint::connect_ ... -
atomic笔记
2013-12-11 11:43 382inline void ice_atomic_set(ic ... -
求最大公共子串
2013-07-15 11:21 717#include <stdio.h> #inc ... -
日志记录
2013-01-14 09:25 736[root@localhost Capserver]# ... -
c开发笔记
2012-02-03 09:36 7011、就是有大量的输入参数或输出参数需要一次性交换时,可以考虑定 ... -
GCC注意笔记
2011-02-22 18:38 723大多数程序和库在编译 ... -
邻接表实现状态图【大家帮忙看看问题】
2010-06-26 18:15 918StatusGrap.cpp // StatusGraph ... -
gsoap编写webservice应用
2010-06-01 15:02 2163The gSOAP tools minimize applic ... -
setsockopt 笔记
2010-04-22 15:12 8091、TCP_NODELAY是唯一使用IPPROTO_TCP层的 ... -
随录-增量记录
2010-02-25 10:41 664程序开发,对于日志的记录需要主要以下几个问题。 1、多线程或 ... -
快速入门sqlite内存数据库,用sqlite构建一日志工具
2009-12-25 11:28 3719今天上午无意在搜索的时候发现很多应用程序用了sqllite,o ... -
dos脚本+ftp实现快速升级
2009-12-25 09:52 1491cd \ ;写ftpget.src文件,存储ftp命令。该文件 ... -
花三分钟看看这个文档
2009-11-30 19:14 795linux 命令精简 Unix/Linux Command ... -
推荐一款xml分析微型库tinyxml
2009-08-22 08:16 1297tinyxml,至所以叫tin,就是短小精悍。搭配前面讲的gs ... -
用gsoap编写webservice客户端接口dll的方法案例
2009-08-22 07:55 29191)使用手册:见http://gsoap2.source ... -
命令随写
2009-08-13 16:22 731ocrale启动监听:lsnrctl start 启动服务:o ... -
LUA 分析文件
2009-06-02 14:07 1138BUFSIZE = 2^13 -- 8K ... -
避免对指针和数字类型重载
2009-05-22 14:17 806条款25: 避免对指针和数字类型重载 快速抢答: ...
相关推荐
内容概要:本文详细介绍了基于MATLAB GUI界面和卷积神经网络(CNN)的模糊车牌识别系统。该系统旨在解决现实中车牌因模糊不清导致识别困难的问题。文中阐述了整个流程的关键步骤,包括图像的模糊还原、灰度化、阈值化、边缘检测、孔洞填充、形态学操作、滤波操作、车牌定位、字符分割以及最终的字符识别。通过使用维纳滤波或最小二乘法约束滤波进行模糊还原,再利用CNN的强大特征提取能力完成字符分类。此外,还特别强调了MATLAB GUI界面的设计,使得用户能直观便捷地操作整个系统。 适合人群:对图像处理和深度学习感兴趣的科研人员、高校学生及从事相关领域的工程师。 使用场景及目标:适用于交通管理、智能停车场等领域,用于提升车牌识别的准确性和效率,特别是在面对模糊车牌时的表现。 其他说明:文中提供了部分关键代码片段作为参考,并对实验结果进行了详细的分析,展示了系统在不同环境下的表现情况及其潜在的应用前景。
嵌入式八股文面试题库资料知识宝典-计算机专业试题.zip
嵌入式八股文面试题库资料知识宝典-C and C++ normal interview_3.zip
内容概要:本文深入探讨了一款额定功率为4kW的开关磁阻电机,详细介绍了其性能参数如额定功率、转速、效率、输出转矩和脉动率等。同时,文章还展示了利用RMxprt、Maxwell 2D和3D模型对该电机进行仿真的方法和技术,通过外电路分析进一步研究其电气性能和动态响应特性。最后,文章提供了基于RMxprt模型的MATLAB仿真代码示例,帮助读者理解电机的工作原理及其性能特点。 适合人群:从事电机设计、工业自动化领域的工程师和技术人员,尤其是对开关磁阻电机感兴趣的科研工作者。 使用场景及目标:适用于希望深入了解开关磁阻电机特性和建模技术的研究人员,在新产品开发或现有产品改进时作为参考资料。 其他说明:文中提供的代码示例仅用于演示目的,实际操作时需根据所用软件的具体情况进行适当修改。
少儿编程scratch项目源代码文件案例素材-剑客冲刺.zip
少儿编程scratch项目源代码文件案例素材-几何冲刺 转瞬即逝.zip
内容概要:本文详细介绍了基于PID控制器的四象限直流电机速度驱动控制系统仿真模型及其永磁直流电机(PMDC)转速控制模型。首先阐述了PID控制器的工作原理,即通过对系统误差的比例、积分和微分运算来调整电机的驱动信号,从而实现转速的精确控制。接着讨论了如何利用PID控制器使有刷PMDC电机在四个象限中精确跟踪参考速度,并展示了仿真模型在应对快速负载扰动时的有效性和稳定性。最后,提供了Simulink仿真模型和详细的Word模型说明文档,帮助读者理解和调整PID控制器参数,以达到最佳控制效果。 适合人群:从事电力电子与电机控制领域的研究人员和技术人员,尤其是对四象限直流电机速度驱动控制系统感兴趣的读者。 使用场景及目标:适用于需要深入了解和掌握四象限直流电机速度驱动控制系统设计与实现的研究人员和技术人员。目标是在实际项目中能够运用PID控制器实现电机转速的精确控制,并提高系统的稳定性和抗干扰能力。 其他说明:文中引用了多篇相关领域的权威文献,确保了理论依据的可靠性和实用性。此外,提供的Simulink模型和Word文档有助于读者更好地理解和实践所介绍的内容。
嵌入式八股文面试题库资料知识宝典-2013年海康威视校园招聘嵌入式开发笔试题.zip
少儿编程scratch项目源代码文件案例素材-驾驶通关.zip
小区开放对周边道路通行能力影响的研究.pdf
内容概要:本文探讨了冷链物流车辆路径优化问题,特别是如何通过NSGA-2遗传算法和软硬时间窗策略来实现高效、环保和高客户满意度的路径规划。文中介绍了冷链物流的特点及其重要性,提出了软时间窗概念,允许一定的配送时间弹性,同时考虑碳排放成本,以达到绿色物流的目的。此外,还讨论了如何将客户满意度作为路径优化的重要评价标准之一。最后,通过一段简化的Python代码展示了遗传算法的应用。 适合人群:从事物流管理、冷链物流运营的专业人士,以及对遗传算法和路径优化感兴趣的科研人员和技术开发者。 使用场景及目标:适用于冷链物流企业,旨在优化配送路线,降低运营成本,减少碳排放,提升客户满意度。目标是帮助企业实现绿色、高效的物流配送系统。 其他说明:文中提供的代码仅为示意,实际应用需根据具体情况调整参数设置和模型构建。
少儿编程scratch项目源代码文件案例素材-恐怖矿井.zip
内容概要:本文详细介绍了基于STM32F030的无刷电机控制方案,重点在于高压FOC(磁场定向控制)技术和滑膜无感FOC的应用。该方案实现了过载、过欠压、堵转等多种保护机制,并提供了完整的源码、原理图和PCB设计。文中展示了关键代码片段,如滑膜观测器和电流环处理,以及保护机制的具体实现方法。此外,还提到了方案的移植要点和实际测试效果,确保系统的稳定性和高效性。 适合人群:嵌入式系统开发者、电机控制系统工程师、硬件工程师。 使用场景及目标:适用于需要高性能无刷电机控制的应用场景,如工业自动化设备、无人机、电动工具等。目标是提供一种成熟的、经过验证的无刷电机控制方案,帮助开发者快速实现并优化电机控制性能。 其他说明:提供的资料包括详细的原理图、PCB设计文件、源码及测试视频,方便开发者进行学习和应用。
基于有限体积法Godunov格式的管道泄漏检测模型研究.pdf
嵌入式八股文面试题库资料知识宝典-CC++笔试题-深圳有为(2019.2.28)1.zip
少儿编程scratch项目源代码文件案例素材-几何冲刺 V1.5.zip
Android系统开发_Linux内核配置_USB-HID设备模拟_通过root权限将Android设备转换为全功能USB键盘的项目实现_该项目需要内核支持configFS文件系统
C# WPF - LiveCharts Project
少儿编程scratch项目源代码文件案例素材-恐怖叉子 动画.zip
嵌入式八股文面试题库资料知识宝典-嵌⼊式⼯程师⾯试⾼频问题.zip