This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> | |
using namespace std; | |
template<typename T> | |
inline const T& | |
max_xx(const T& x, const T& y) | |
{ | |
return y < x ? x : y; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <shlobj.h> | |
#include <shlwapi.h> | |
#include <objbase.h> | |
//#include <Windows.Foundation.h> | |
using namespace std; | |
class COM | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <algorithm> | |
#include <cstring> | |
#include <utility> | |
#include <cassert> | |
#include <iostream> | |
using namespace std; | |
#if 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define YB_T_NO_MATH 1 | |
//#define YB_T_NO_IOSTREAM 1 | |
//#define YB_T_NO_TIMING 1 | |
#define YTEST_B 4 | |
#include "../../Temp/test.h" | |
#include <ysbuild.h> | |
#include <Helper/HostWindow.h> | |
#include <windows.h> | |
#include "../HelperEx/Shells.h" | |
#include <NPL/SContext.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.多语言字符集和编码相关的参考规范之中最重要的有两个,一个是ISO/IEC 10646,一个是 Unicode 。 | |
前者是专家委员会起草的国际标准。(前身还有两个不同的草案,因为中国大陆等方面的反对而否决。) | |
后者是行业协会组织的规范。ISO/IEC 10646正式版采用Unicode方案,之后的版本也和 Unicode 有基本的对应关系(虽然不一一对应),对普通应用来说基本可以作为同一个方案。 | |
2.Unicode 定义了通用字符集(Universal Character Set, UCS) ,其中以代码点(code point) 作为逻辑上区分字符的单位。 | |
由于历史原因,各种同源字符可能有不同的代码点,这方面汉字( CJKV unified ideographs ,中日韩越统一表意文字)问题尤其突出(相关工作称为Han Unification)。代码点可以由 U+X 的方式表示,X是16进制的自然数。 | |
3.现行 UCS 代码点范围 U+0~U+10FFFF ,划分为 17 个平面,编号 0~16 ,每个平面有 65536 个代码点。 | |
其中最常用的代码点子集是 0 号平面(代码点 U+0~U+FFFF ):基本多文种平面(basic mutilingual plane, BMP) ,之后是第一辅助平面:多文种补充平面(supplementary multilingual plane, SMP) 和第二辅助平面:表意文字补充平面(supplementary ideographic plane, SIP) 。第三至十三辅助平面尚未使用。第十四辅助平面称为特别用途补充平面(supplementary special-purpose plane, SSP) ,其中是控制字符。剩下的两个平面是私人使用区(private use area) 。 | |
一个平面内的代码点可以被两个八元组(octet) 表示,也就是 16 位二进制整数。一般 C/C++ 实现使用的一个字节正好有 8 位,但不总是保证。 | |
4.以 UCS 为基础可以表示文本编码。 | |
早期使用 UCS 限定于现在的一个平面内,可以用 16 位编码(两个八元组)表示任意的 Unicode 代码点,称为 UCS-2 。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename _type, std::uintmax_t _vNum = 1, std::uintmax_t _vDen = 1, | |
bool _bIsFloat = std::is_floating_point<_type>::value> | |
struct normalized_max; | |
template<typename _type, std::uintmax_t _vNum, std::uintmax_t _vDen> | |
struct normalized_max<_type, _vNum, _vDen, true> | |
{ | |
static yconstexpr _type value = double(_vNum / _vDen); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
版权声明:本文使用 CC-BY-SA 3.0 发表。 | |
应作者要求,阅《轻松学习C程序设计——揭开计算机与程序设计的奥秘(修订版)》(资源通过网络找到),评论如下。 | |
(此处找到的材料的节标号可能有错乱,按页面顺序评论。因此也不保证分节评论。) | |
1 计算机的重要性和基本工作原理 | |
·作者使用“理想厨房系统”作为计算机系统的比喻。有以下一些问题: | |
难以估计对于初学者来说这个比喻是否得当,有助于真正理解。 | |
厨房中突兀地出现了“地址传送带”“控制传送带”“IR”“PC”“R0”等和喻体不直接相关的生造抽象。这些抽象是否真容易理解?后面虽然有比较详细的说明,但细节并不十分直观且篇幅不小,可能对读者造成负担。 | |
语言风格问题。虽然总体比较清晰,但一些名词并不十分浅显易懂(相反容易觉得很“专业”——某种意义上事实的确如此)。如“取指周期”——具体什么意思,并没有在此直接解释。 | |
·《理想厨房系统与计算机系统术语对照表》中“内存(又称为主存,包含很多大小相等的基本存储单元)”——错误。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#include <ystdex/variadic.hpp> // uncommitted, see file attached; | |
//#include <ystdex/type_op.hpp> // see YSLib/YBase::YStandardEx; | |
//#include <ystdex/functional.hpp> // ditto; | |
//#include <YSLib/Core/yevt.hpp> // for test; | |
//#include <YSLib/UI/ywidget.h> // ditto; | |
#include <YSLib/UI/ypanel.h> // all above included; | |
namespace ystdex | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clang++ -std=c++1y a.cc -o a.exe | |
#include <cstdio> | |
void seq(){} | |
template<class T, class... P> void seq(T arg, P... args){ static_cast<void>(arg()); seq(args...); } | |
auto curry = [](auto f){return [f](auto... x){return [=](auto y){return f(x..., y); }; }; }; | |
auto make_seq = [](auto f){return [f](auto... x){seq([=]{return f(x);}...); }; }; | |
auto seq_curry = [](auto f){return curry(make_seq(f)); }; | |
template<size_t N> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ytest/timing.hpp> // https://github.com/FrankHB/YSLib/blob/master/YBase/include/ytest/timing.hpp | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
using namespace ytest::timing; | |
struct tr | |
{ |
OlderNewer