码迷,mamicode.com
首页 >  
搜索关键字:nullptr    ( 398个结果
Delete Node in a Linked List
该题的难点在于单链表没法删除节点,那么就只能将该节点后续所有节点的值前移覆盖当前节点的值。需要注意的是在移动到倒数第二个节点的时候在覆盖其值之后需要将其下一个节点指向 nullptr。class Solution { public: void deleteNode(ListNode* node) { if(node == nullptr) retur...
分类:其他好文   时间:2015-07-18 18:40:44    阅读次数:146
c++11 改进设计模式 Singleton模式
关于学习 《深入应用c++11》的代码笔记:c++11之前是这么实现的templateclass Singleton{public: static T* Instance(){ if (m_pInstance == nullptr) m_pInstance = new T(); return...
分类:编程语言   时间:2015-06-29 00:17:03    阅读次数:245
c++ 中的空指针和void指针
指针空值nullptr #include using namespace std; int main() { //!void voidObject; 错,不能声明void类型的变量 void *pv; //对,可以声明void类型的指针 int i = 5; pv = &i; //void类型指针指向整型变量 int *pint = static_cast(pv); //void指针转换为in...
分类:编程语言   时间:2015-05-20 09:50:41    阅读次数:148
c++ 中常量指针和指针常量
C++11使用nullptr关键字,是表达更准确,类型安全的空指针 指向常量的指针 不能通过指向常量的指针改变所指对象的值,但指针本身可以改变,可以指向另外的对象。 例 int a; const int *p1 = &a; //p1是指向常量的指针 int b; p1 = &b; //正确,p1本身的值可以改变 ...
分类:编程语言   时间:2015-05-20 09:49:02    阅读次数:96
LeetCode "Word Search II"
Trie, again.class TrieNode {public: // Initialize your data structure here. TrieNode() : prev(nullptr), c(0), bIsLast(false) { } TrieNo...
分类:其他好文   时间:2015-05-20 07:07:16    阅读次数:119
ANSI转UNICODE,UNICODE转ANSI
(1)ANSI转UNICODEwchar_t*AnsiToUnicode(constchar*pAnsi) { intnLen=MultiByteToWideChar(CP_ACP,0,pAnsi,strlen(pAnsi),nullptr,0); wchar_t*pUnicode=newwchar_t[nLen+1]; MultiByteToWideChar(CP_ACP,0,pAnsi,strlen(pAnsi),pUnicode,nLen); pUnicode[nLen]=‘\0‘; returnpU..
分类:其他好文   时间:2015-05-19 07:19:38    阅读次数:209
nil、Nil、NULL与NSNull的区别
1.nil 指向一个对象的指针为空 在objc.h中的定义如下所示: #ifndef nil # if __has_feature(cxx_nullptr) # define nil nullptr # else # define nil __DARWIN_NULL # endif #endif在Objective-C中用于id类型的对象 NSString *name = ni...
分类:其他好文   时间:2015-05-14 12:00:08    阅读次数:136
空指针带来的AV异常.
故名思意, 如果一个指针是NULL, (NullPtr == NULL), 则 NullPtr->Method() 会产生异常。 但是根据被调用函数不同, 分为 (1)NullPtr->Virtual_Method()(2)NullPtr->Member_Method() 和 // ...
分类:其他好文   时间:2015-05-13 21:47:01    阅读次数:241
华容道05--关卡数据的显示
地图的显示需要在GameLayer中,需要有一个关卡的引用。 Level * m_pLevel;//<关卡数据的引用 cocos2d::Vector m_pRoleSpriteVec ;//<存储角色精灵 GameLayer::GameLayer() :m_pLevel(nullptr) { m_pLevel = Level::s_levelVec.at(0) ; CC_SAFE_RET...
分类:其他好文   时间:2015-04-14 21:35:54    阅读次数:118
初始化指针
#include using namespace std; int main() { int *a(nullptr), *b(NULL), *c(0); if(!a) cout<<" 'a' does not point to anything. \n"; if(!b) cout<<" 'b' does not point to anything. \n"; if(!c) cout<<" ...
分类:其他好文   时间:2015-04-12 09:21:16    阅读次数:118
398条   上一页 1 ... 34 35 36 37 38 ... 40 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!