c++中POD类型和non-POD类型
摘要:对于一个array来说: For POD-types, a shallow copy or memcpy of the whole array is good enough, while for non-POD types, we need to perform element by element
阅读全文
posted @
2018-09-11 17:29
今夜太冷
阅读(2057)
推荐(1) 编辑
关于c++ template的branching和Recursion的一段很好的描述
摘要:来自: <Learning Boost C++ Libraries> 第290页
阅读全文
posted @
2018-09-10 11:50
今夜太冷
阅读(298)
推荐(0) 编辑
C++ delegate的几种方法
摘要:https://stackoverflow.com/questions/9568150/what-is-a-c-delegate You have an incredible number of choices to achieve delegates in C++. Here are the on
阅读全文
posted @
2018-09-03 14:33
今夜太冷
阅读(2139)
推荐(0) 编辑
boost::make_function_output_iterator报错: C4996
摘要:用VS2013运行boost::make_function_output_iterator的官方例子: https://www.boost.org/doc/libs/1_68_0/libs/iterator/doc/function_output_iterator.html 1 2 3 4 5 6
阅读全文
posted @
2018-08-28 16:17
今夜太冷
阅读(599)
推荐(0) 编辑
How to copy the contents of std::vector to c-style static array,safely?
摘要:[问题] I am getting warning when using the std copy function. I have a byte array that I declare. Then I have a couple other byte arrays that are declar
阅读全文
posted @
2018-08-28 10:59
今夜太冷
阅读(268)
推荐(0) 编辑
std::vector push_back报错Access violation
摘要:C/C++ code ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #include <vector> #include <string> #include <iostream> struct Pe
阅读全文
posted @
2018-08-27 15:45
今夜太冷
阅读(1160)
推荐(0) 编辑
Structured Exception Handling
摘要:https://docs.microsoft.com/en-us/windows/desktop/Debug/structured-exception-handling An exception is an event that occurs during the execution of a pr
阅读全文
posted @
2018-08-27 14:03
今夜太冷
阅读(302)
推荐(0) 编辑
Catch a Memory Access Violation in C++
摘要:From: https://stackoverflow.com/questions/16612444/catch-a-memory-access-violation-in-c In C++, is there a standard way (or any other way, for that ma
阅读全文
posted @
2018-08-27 13:45
今夜太冷
阅读(723)
推荐(0) 编辑
Windows上的字符转换之CP_ACP和CP_OEMCP
摘要:原文地址:http://blog.sina.com.cn/s/blog_53c1950a010158mw.html Windows API函数MultiByteToWideChar用于多字节编码字符串向宽字符串(即UTF-16 LE)的转码。它的第一个参数的常用值是CP_ACP和CP_OEMCP。这
阅读全文
posted @
2018-08-24 21:28
今夜太冷
阅读(1896)
推荐(0) 编辑
Initialize a vector in C++ (5 different ways)
摘要:https://www.geeksforgeeks.org/initialize-a-vector-in-cpp-different-ways/ Following are different ways to create and initialize a vector in C++ STL Ini
阅读全文
posted @
2018-08-21 11:43
今夜太冷
阅读(234)
推荐(0) 编辑
MFC中使用ATL报错:error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
摘要:我在MFC中使用ATL函数A2W的时候报如下的错误: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 【解决方法】 https://www.xuebuyuan.com/
阅读全文
posted @
2018-08-18 20:41
今夜太冷
阅读(544)
推荐(0) 编辑
C++ WINDOWS下 wchar_t *和char * 相互转化总结篇
摘要:说道wchar_t和char两个类型大家都不会陌生 wchar_t:在windows下是Unicode 16编码,也就是俗称宽字节 char:当然就是指一个字节,在windows下面默认是gbk编码的 所以在windows 下 wchar_t 转 char也就是编码转化 直接贴出wchar_t *字
阅读全文
posted @
2018-08-18 19:35
今夜太冷
阅读(13411)
推荐(0) 编辑
VS2008 编译出错 fatal error C1859: unexpected precompiled header error, simply rerunning the compiler might fix this problem
摘要:https://jingyan.baidu.com/article/d8072ac49ebd23ec95cefddd.html https://jingyan.baidu.com/article/d8072ac49ebd23ec95cefddd.html
阅读全文
posted @
2018-08-17 17:27
今夜太冷
阅读(667)
推荐(0) 编辑
strncpy, strncpy_s
摘要:Defined in header <string.h> char *strncpy( char *dest, const char *src, size_t count ); char *strncpy( char *restrict dest, const char *restrict src,
阅读全文
posted @
2018-08-08 11:06
今夜太冷
阅读(3687)
推荐(0) 编辑
Compiler Error: Function call with parameters that may be unsafe
摘要:如下的代码: #include <stdio.h> #include <string> #include <algorithm> #include <cassert> #include <cctype> #include <boost/algorithm/string.hpp> int main(i
阅读全文
posted @
2018-07-24 13:57
今夜太冷
阅读(276)
推荐(0) 编辑
fopen和fopen_s用法的比较
摘要:open和fopen_s用法的比较 fopen 和 fopen_s fopen用法: fp = fopen(filename,"w")。 fopen_s用法:,须定义另外一个变量errno_t err,然后err = fopen_s(&fp,filename,"w")。 返回值: fopen打开文件
阅读全文
posted @
2018-07-20 15:56
今夜太冷
阅读(33608)
推荐(3) 编辑
fopen_s遇到的一个问题
摘要:今天使用公司代码的日志模块记录程序运行的相关信息,发现日志总是只有两条记录,即程序启动和结束,别的都没有。跟踪了很久,终于发现是日志输出模块被我修改了一个地方:把fopen改成了fopen_s,毕竟报了warning。但是这也是问题的根源! 下面的说明来自于msdn: Files opened by
阅读全文
posted @
2018-07-20 15:46
今夜太冷
阅读(1887)
推荐(2) 编辑
Using std::map with a custom class key
摘要:From: https://www.walletfox.com/course/mapwithcustomclasskey.php If you have ever tried to use a custom class as a key of std::map, most probably you
阅读全文
posted @
2018-07-02 13:54
今夜太冷
阅读(614)
推荐(0) 编辑
A very simple C++ module to encrypt/decrypt strings based on B64 and Vigenere ciper.
摘要:A very simple C++ module to encrypt/decrypt strings based on B64 and Vigenere ciper. https://github.com/philipperemy/easy-encryption Easy Encryption A
阅读全文
posted @
2018-06-24 19:21
今夜太冷
阅读(316)
推荐(0) 编辑
操作argc, argv的经典写法
摘要:[问题] 我在看boost源代码的时候看到如下的代码, 不明白里面的argv+argc+!argc是干什么用的, 请高手指教,谢谢附上to_internal函数: [答案] 一般而言,argc表示参数个数,argv表示参数数组,argv[0]表示程序自己的名称如 运行程序名为z1.exe 带参数 为
阅读全文
posted @
2018-06-04 14:50
今夜太冷
阅读(306)
推荐(0) 编辑