Extension Method: Return another string if string is null or emptyJust a tiny little extension method. You may know the ?? operator for null checks:va...
分类:
其他好文 时间:
2015-01-13 23:00:25
阅读次数:
211
#includeusing namespace std;class String{ friend ostream& operator=0&&e<=strlen(m_data)) return m_data[e];}ostream& operator<<(ostream& os,String& str...
分类:
其他好文 时间:
2015-01-12 22:13:28
阅读次数:
159
Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT. 1 public class Solution { 2 public ...
分类:
其他好文 时间:
2015-01-12 00:18:28
阅读次数:
293
1.BNF范式%token T_OBJECT_OPERATOR "-> (T_OBJECT_OPERATOR)"unticked_statement:| expr ';' { zend_do_free(&$1 TSRMLS_CC); }expr: r...
分类:
Web程序 时间:
2015-01-11 22:51:50
阅读次数:
366
这里是用 JavaScript 做的逆转序列(数组/字符串)的递归/尾递归实现。另外还尝鲜用了一下 ES6 的destructuring assignment + spread operator 做了一个更 functional 的版本(只支持数组)。正确性能通过测试(参见 放在我 Github 上...
分类:
编程语言 时间:
2015-01-11 06:12:23
阅读次数:
283
思想都在我的这篇博客里面。
呃,那道题懂差不多之后随便水水这道题就过了。
#include
#include
#include
#include
#define N 1010
using namespace std;
struct KSD
{
long long a;
int b;
bool operator d.a:b>d.b;}
}x[N];
long long ins[70...
分类:
其他好文 时间:
2015-01-10 08:52:23
阅读次数:
162
Divide two integers without using multiplication, division and mod operator.
If it is overflow, return MAX_INT.
时间复杂度 log(n)
public class Solution {
public int divide(int dividend, int divi...
分类:
其他好文 时间:
2015-01-09 22:22:15
阅读次数:
248
转载来源:http://c.biancheng.net/cpp/biancheng/view/216.html重载运算符的函数一般格式如下: 函数类型 operator 运算符名称 (形参表列) { // 对运算符的重载处理 }例如,想将”+”用于Complex类(复数)的加法运算,函数...
分类:
编程语言 时间:
2015-01-09 22:07:50
阅读次数:
235
核心模块1.1.介绍1.2.__builtin__模块1.3.exceptions模块1.4.os模块1.5.os.path模块1.6.stat模块1.7.string模块1.8.re模块1.9.math模块1.10.cmath模块1.11.operator模块1.12.copy模块1.13.sys...
分类:
编程语言 时间:
2015-01-08 17:50:59
阅读次数:
2840
当operator new申请一个内存失败的时候,它会进行如下的处理步骤: 1、如果存在客户指定的处理函数,则调用处理函数(new_handler),如果不存在则抛出一个异常。 2、继续申请内存分配请求。 3、判断申请内存是否成功,如果成功则返回内存指针,如果失败转向处理步骤1为了自定义这个“用以处...
分类:
编程语言 时间:
2015-01-08 08:20:33
阅读次数:
168