
c++
文章平均质量分 72
is2120
这个作者很懒,什么都没留下…
展开
-
LeetCode.25 Reverse Nodes in k-Group
写得不简洁,1h。总结一个清晰简洁的版本。class Solution{public: void reversList(ListNode* head, ListNode* tail, ListNode* prev_sec_tail, ListNode* next_sec_head) { if (!head) { return; } ListNode* head...原创 2018-08-16 17:00:23 · 257 阅读 · 0 评论 -
C++标准库扩展权威指南 (zz)
译者序前言第一部分 基本工具 第1章 元组 1.1 头文件的摘要 1.2 tuple类模板 1.3 像tuple一样对std::pair进行存取 1.4 练习 第2章 智能指针 2.1 定义 2.2 关于示例 2.3 头文件的摘要 2.4 shared_ptr类模板 2.5 类模板weak_ptr 2.6 类模板enabl原创 2014-05-18 20:49:27 · 1479 阅读 · 0 评论 -
Code Snippet
c/c++求两个日期之间的间隔天数原创 2014-04-22 13:19:19 · 801 阅读 · 0 评论 -
c++ std string reserve 测试
1531477010515723535252879211881782267340096013901913528202923043845657684851027271540902311353467025200537800791170118175517726327653949147原创 2014-04-10 11:52:34 · 1545 阅读 · 0 评论 -
inttypes.h 和 stdint.h 兼容定义
// ISO C9x compliant inttypes.h for Microsoft Visual Studio// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 // // Copyright (c) 2006 Alexander Chemeris// // Redistribution原创 2014-04-04 14:00:52 · 3780 阅读 · 0 评论 -
Format Specifiers in C++ (zz)
Format Specifiers in C++The following tables show the format specifiers recognized by the debugger.SpecifierFormatExpressionValue Displayedd,isigned decimal integer原创 2013-07-16 19:58:00 · 1255 阅读 · 0 评论 -
CString TO Double (zz)
//z 2013-10-21 15:01:30 IS2120@BG57IV3 T3345574402.K.F3396121938[T3,L303,R3,V37]1. atl CString 转换成 double 浮点数A CString can convert to an LPCTSTR, which is basically a const char* (const wc原创 2013-10-21 15:03:10 · 1493 阅读 · 0 评论 -
VA release notes (zz)
//z 2013-12-25 15:19:01 IS2120@BG57IV3 T597988623 .K.F3153028746[T147,L1747,R82,V2575]Archive and release notes for most recent builds of Visual AssistRelease notes apply to all IDEs unl原创 2013-12-25 15:21:56 · 4045 阅读 · 0 评论 -
RAII is a must know technique for c++ programmers (zz)
http://qtandopencv.blogspot.com/2013/10/why-raii-is-must-know-technique-for-c.htmlRAII is a must know technique for c++ programmers, no excuse.//z 2013-11-13 17:32:19 IS2120@BG57IV3 T30517原创 2013-11-13 17:32:16 · 974 阅读 · 0 评论 -
c++ book (IS2120@BG57IV3)
//z 2013-04-15 13:20:59 IS2120@BG57IV3.T313102098 .K[T424,L5832,R188,V6844]ReferenceStyle - All LevelsThe C++ Programming Language (Bjarne Stroustrup) (soon to be updated for C++11) The classic原创 2012-12-08 17:13:51 · 1263 阅读 · 0 评论 -
c++ 输出 变量名 字符串(zz.is2120.BG57IV3)
#define SHOW(a) std::cout // ...int i = 2;SHOW (i);//z 2013-01-29 16:19:23 IS2120@BG57IV3.T739790998 .K[T104,L1428,R47,V1454]Hey, I like that macro. If you don't mind, I'm going to improve it j原创 2013-01-29 16:14:54 · 915 阅读 · 0 评论 -
vc 版本 宏 (zz.IS2120@BG57IV3)
visual studio c++ 不同 版本 定义 宏//z 2013-01-28 10:19:58 IS2120@BG57IV3.T3314393399.K[T82,L1217,R37,V1207]_MSC_VER is what you need. You can also examine visualc.hpp in any recent boost install for som原创 2013-01-28 10:16:06 · 828 阅读 · 0 评论 -
fgetws 讀取Unicode文件 (zz.IS2120@BG57IV3)
//z 2012-11-22 18:48:32 IS2120@BG57IV3.T2690489747.K[T4,L45,R0,V24]fgetws 讀取Unicode文件fgetws _fgetts 读取 中文 乱码 unicode 双字节 多字节最近要讀取一個unicode文件做額外處理,但是透過 fgetws 去讀取檔案,利用WriteConsole顯示在console畫面原创 2012-11-22 18:45:55 · 2157 阅读 · 0 评论 -
Stlport Tips
//z 2012-6-8 17:54:59 PM is2120@csdn.T22489446661. stlport 静态链接与动态链接如果程序要使用静态库的话必须定义宏:_STLP_USE_STATIC_LIB如果程序要使用动态库的话必须定义宏: _STLP_USE_DYNAMIC_LIB (貌似这个是默认的)2. Visual C++ says “LNK1104: ca原创 2012-06-08 17:52:01 · 608 阅读 · 0 评论 -
vector tips
1. 查找vector中某个元素是否存在std::find(vector.begin(), vector.end(), item)!=vector.end()2. 从iterator得到位置( position )it = std::find(vector.begin(), vector.end(), item)if(it != v.end()){ return it原创 2012-02-03 18:11:31 · 626 阅读 · 0 评论 -
LevelDB 之 arena
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file. See the AUTHORS file for names o原创 2014-06-05 10:45:03 · 1087 阅读 · 0 评论 -
c++ print stacktrace
c++ stack print stack trace debug utility原创 2014-06-30 12:39:42 · 2338 阅读 · 0 评论 -
obs 之 OBSObj
从实例学习c++之:1. 内联构造/虚构2. 移动构造/移动赋值3. 禁用拷贝构造和赋值4. 该类虚构不为 virtual 5. 使用实例 using OBSDisplay = OBSObj;//k 18-02-06 23:13 2 zn#1 不被实例化的对象//k 18-02-06 23:47 28 zn#1 这里 destroy 是一个 nontyp par原创 2018-02-06 23:59:27 · 397 阅读 · 1 评论 -
c++ 书籍(zz)
下面是转载的在博客上看到的一个C++书籍阅读清单,可以参考下: 阶段 1 《Essential C++》 这是一本内容不多但很实用的C++入门书籍,强调快速上手与理解C++编程。本书主要围绕一系列逐渐复杂的程序问题,以及用以解决这些问题的语言特性展开讲解。你不只学到C++的函数和结构,也会学习到它们的设计目的和基本原理。 《C++ Primer》 本书对C++基本概念、原创 2015-03-16 23:07:00 · 860 阅读 · 0 评论 -
Effective Modern C++
Chapter 1 Deducing Types Item 1: Understand template type deduction. Item 2: Understand auto type deduction. Item 3: Understand declt原创 2014-12-10 16:53:56 · 2173 阅读 · 0 评论 -
boost shared ptr
1. 使用智能指针的例子。 //z 2014-10-29 14:34:09 L.63 '33951 BG57IV3@XCL T892754998 .K.F2002403129[T9,L298,R11,V257] #include #include #include #include void testSharedPtr原创 2014-10-29 14:53:45 · 746 阅读 · 0 评论 -
c++ windows error C2662 C2663
//z 2014-08-12 12:39:50 L.141'40810 BG57IV3@XCL T961939060 .K.F37272252 [T14,L639,R15,V232] VC C++ windows error C2662 C2663 在const成员函数中调用如下语句时: CBitmap *pOldBitmap = m_dc.SelectObject(&bmpIcon原创 2014-08-12 12:39:02 · 1727 阅读 · 0 评论 -
调试 -- 为GUI程序添加控制台调试信息输出
//z 2014-08-09 22:35:42 L.144' 5058 BG57IV3@BYH T3162696792.K.F3863291090[T5,L330,R3,V36] IS2120 1. 在winmain 中添加 AllocConsole(); freopen("CONIN$", "r", stdin); freopen("CONOUT$", "w", stdou原创 2014-08-09 22:35:04 · 713 阅读 · 0 评论 -
vc++ 调试Release 版本
//z 2014-08-09 23:49:21 L.144' 639 BG57IV3@BYH T160527067 .K.F3103894817[T2,L91,R2,V16] IS2120 c++ windows 调试 release 发布 版本 IS2120@优快云 · C/C++ > General > Debug Information Format should be "Pr原创 2014-08-09 23:49:44 · 602 阅读 · 0 评论 -
0x7743fcec 处未处理的异常: 0xC015000F: 正被停用的激活上下文不是最近激活的
//z 2014-07-15 10:36:11 L.169'48229 BG57IV3@XCL T2225937918.K.F3399197987[T19,L485,R12,V288]0x7743fcec 处未处理的异常: 0xC015000F: 正被停用的激活上下文不是最近激活的最近调试程序时遇到了关于AfxDeactivateActCtx的错误,看堆栈也没任何信息量!崩溃的地方如下原创 2014-07-15 10:41:21 · 8730 阅读 · 0 评论 -
c++ 计时
class ZTimer{public: ZTimer() { _startCount.QuadPart = 0; _endCount.QuadPart = 0; QueryPerformanceFrequency(&_frequency); QueryPerformanceCounter(&_startCount); } double Elapsed() {原创 2014-06-19 17:17:30 · 605 阅读 · 0 评论 -
ZLogger
ZLogger.hpp#pragma onceclass ZLogger{public: //z gnu log level : DEBUG < INFO < WARN < TRACE < ERROR < ALERT < CRIT < FATAL < EMERG enum {kInfo,kWarning,kError};public: static bool Log(LP原创 2014-07-15 16:44:29 · 848 阅读 · 0 评论 -
如何使用 Boost.Func
//z 2014-07-24 14:53:32 L.160'32788 BG57IV3@XCL T491489982 .K.F916674775 [T6,L181,R3,V64] 1. 概述 Boost.Func 允许你创建各种类型的函数指针变量。 Boost.Bind 能够动态bind一个函数到函数指针变量。 2. 声明一个boost::function 变量原创 2014-07-24 14:54:02 · 675 阅读 · 0 评论 -
c++11 : range-based for loop
1. #include #include int main (){ std::vector data = { 1, 2, 3, 4 }; for ( int datum : data ) { std::cout << datum << std::endl; }}原创 2014-06-12 13:29:40 · 3534 阅读 · 0 评论 -
35个你也许不知道的Google开源项目
<br />Google是支持开源运动的最大公司之一,它们现在总共发布有超过500个的开源项目(大部分都是利用它们的API来完成),本文将列举一些有趣的开源项目,其中很可能有不少你不知道的哦。<br /><br /> 文本文件处理:<br /><br />Google CRUSH (Custom Reporting Utilities for SHell)<br /><br /> CRUSH是为命令行或shell scripts处理特定文字数据而制作的一系列工具,这里有指南。转载 2011-03-17 15:28:00 · 1141 阅读 · 0 评论 -
strcpy的返回值有什么用?
在面试中常会遇到写 strcpy,以及相关的问题,比如说返回值的作用等。//z 2012-07-06 10:23:32 AM IS2120@优快云.T1445120086以下为微软clib中的strcpy的写法。/****char *strcpy(dst, src) - copy one string over another**Purpose:* Cop原创 2011-06-07 21:34:00 · 6164 阅读 · 2 评论 -
The file contains a character that cannot be represented in the current code page (936)
1. 方法一:将文件中的乱码找到去掉//z 2012-07-06 10:22:32 AM IS2120@优快云.T113491669 用VS2005+DirectX9 SDK(手头测试过的是2004年10月的DirectX SDK和2006年4月的DirectX SDK)编译游戏会出现以下warning:------------------------------------原创 2011-09-08 20:30:15 · 15024 阅读 · 2 评论 -
c++中的位操作
<br />c++中的位操作<br /><br />使用or设置位<br /> number |= 1 << x;<br />将设置位x<br /><br />清除位<br />使用位操作&清除位。<br /> number &= ~(1 << x);<br />这将清除位x。<br /><br />转换位<br />XOR 操作 (^)<br /> number ^= 1 << x;<br /><br />检查位<br /> bit = number & (原创 2011-04-26 21:12:00 · 791 阅读 · 0 评论 -
不用循环和条件判断打印1-1000
————————————————————————————————————————————#includetemplatestructNumberGeneration{ staticvoid out(std::ostream& os) { NumberGeneration::out(os); os }};templatestructNumberGeneration{ staticvoid out(std::ostream& os) { os原创 2011-04-24 23:28:00 · 1684 阅读 · 1 评论 -
c++ 书籍推荐
对于所有人都适用-参考手册 The C++ Programming Language (Bjarne Stroustrup) C++ Standard Library Tutorial and Reference(Nicolai Josuttis) The C++ IO Streams and Locales (Angelika Langer and Klaus Kreft)入门级 C++ Primer† (Stanley Lippman, Josée Lajo原创 2011-04-24 23:00:00 · 830 阅读 · 0 评论 -
什么时候你需要一个虚构函数是虚的
Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 <!-- /* Style原创 2011-06-10 23:04:00 · 1210 阅读 · 0 评论 -
boost.array 使用实例
//z 2011-06-08 23:20:20@is2120.优快云 转载请注明出处#include //z 包含 array 相关头文件。#include using namespace std;using namespace boost;//z 仿函数,输出array各元素。class P原创 2011-06-08 23:26:00 · 1198 阅读 · 0 评论 -
通过一个非法的指针或者NULL指针调用成员函数会发生什么?
<br />通过一个非法的指针或者NULL指针调用成员函数会发生什么?#include<iostream><br /><br />struct foo<br />{<br /> void bar(){ std::cout <<"gman was here"<< std::endl;}<br /> void baz(){ x =5;}<br /><br /> int x;<br />};<br /><br />int main()<br />{<br /> foo* f原创 2011-04-21 01:36:00 · 1030 阅读 · 0 评论 -
assert vs. ASSERT(mfc) vs. VERIFY
<br /> assert vs. ASSERT(mfc) 区别<br /> 1. 首先 assert 是c标准里的一个宏,而ASSERT是MFC的一个宏。<br /><br /> 2. assert 可以通过 NDEBUG 来关闭。<br /><br /> 3. assert 在 debug 版本和 release 版本里都可用,另两个宏_ASSERT 和 _ASSERTE<br /> 只有当_DEBUG标志被定义的情况下才能使用。<br /><br />原创 2011-05-18 22:31:00 · 1410 阅读 · 0 评论 -
C++界面库的抉择
<br />C++的界面库经过几天来的搜索,总结了下面几种的优缺点<br /><br />1. MFC<br /><br />优点:VS2008以及VS2010的扩展确实很强大,特别是原生的窗口运行时停靠以及<br />PropertyGrid确实很强大<br /><br />缺点:默认字体很模糊,无论你对MFC多了解,C++多熟悉,每次写代码时依然要重新熟<br />悉代码,更不用提分析别人写的MFC代码,一个字:乱。<br /><br />2. WTL<br /><br />转载 2011-03-25 21:47:00 · 1357 阅读 · 0 评论