码迷,mamicode.com
首页 >  
搜索关键字:stl array    ( 35607个结果
调试常用的方法
1 object.methods() # 列出对象的类的实例方法。即该实例的可用方法列表。puts [].methods.grep /^re/ #列出Array以re开头的实例方法列表2 object.instance_variables() #列出对象(Module或Class)的实例变量cl.....
分类:其他好文   时间:2014-05-09 04:05:02    阅读次数:278
leetcode第一刷_Construct Binary Tree from Inorder and Postorder Traversal
这道题是为数不多的感觉在读本科的时候见过的问题。人工构造的过程是怎样呢,后续遍历最后一个节点一定是整棵树的根节点,从中序遍历中查找到这个元素,就可以把树分为两颗子树,这个元素左侧的递归构造左子树,右侧的递归构造右子树,元素本身分配空间,作为根节点。 于set和map容器不同的是,vector容器不含find的成员函数,应该用stl的库函数,好在返回的也是迭代器,而vector的迭代器之间是可以做...
分类:其他好文   时间:2014-05-09 01:23:38    阅读次数:275
误释放对象
问题一:value = [array objectAtIndex:n]; //得到一个数组中的对象[arry removeObjectAtIndex:n]; //卸载那个对象因为value得到了那个对象,但是由于另外一个拥有者release了该对象,所以其实value现在成了摇摆指针(无效数据)问题...
分类:其他好文   时间:2014-05-09 00:02:03    阅读次数:366
常用判断
isset:变量是否设置,或者是否未null$var="11";isset($var);返回1isset($empty);返回0数组$arr=array();isset($arr);返回1empty:""、0、"0"、NULL、FALSE、array()、var $var;以及没有任何属性的对象都将...
分类:其他好文   时间:2014-05-08 23:43:03    阅读次数:350
STL--容器适配器(queue、priority_queue、stack)
适配器(Adaptor)是提供接口映射的模板类。适配器基于其他类来实现新的功能,成员函数可以被添加、隐藏,也可合并以得到新的功能。STL提供了三个容器适配器:queue、priority_queue、stack。这些适配器都是包装了vector、list、deque中某个顺序容器的包装器。注意:适配...
分类:其他好文   时间:2014-05-08 23:13:29    阅读次数:298
MySQL源码 数据结构array
MySQL源码中自己定义了许多数据结构,放在mysys的目录下,源码中通常都使用这些数据结构来组织存放数据,也更容易实现跨平台。下面先来看下MySQL定义的动态数组:【源代码include/array.h mysys/array.c】typedef struct st_dynamic_array{ ...
分类:数据库   时间:2014-05-08 18:10:32    阅读次数:392
LeetCode——Single Number(II)
Single Number  Total Accepted: 19800 Total Submissions: 44027My Submissions Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algor...
分类:其他好文   时间:2014-05-08 11:01:40    阅读次数:298
Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...
分类:其他好文   时间:2014-05-08 07:29:02    阅读次数:285
Leetcode | Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu...
分类:其他好文   时间:2014-05-08 06:33:29    阅读次数:339
yii验证表单
1、yii框架中验证的类文件:上面红线内是验证的具体的类文件,下面的这个文件制定了类的别名。2、验证邮箱的时候默认不能为空,除了可以在模型里面设置为required外,还可以在模型的rule里面,在对应的email类里面可以看到这个allowEmpty参数。array(‘kemail‘,‘email‘,‘allowEm..
分类:其他好文   时间:2014-05-08 02:37:35    阅读次数:1080
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!