什么是单一职责原则? 单一职责原则的英文名称是Single Responsibility
Principle,简称是SRP。SRP原则的解释是:There should never be more than one reason for a
class to change。定义很简单,即不能存在多....
分类:
其他好文 时间:
2014-06-12 15:29:46
阅读次数:
202
vector v:初始化一个0大小的向量vector
v(10):初始化一个10个大小的向量push_back:增加一个元素pop:删除一个元素,不返回front:返回第一个元素back:返回最后一个元素at:返回特定位置的元素capacity:vector的容量,会自动扩大也可以直接通过v[x]操...
分类:
编程语言 时间:
2014-06-12 12:06:47
阅读次数:
285
#include #include char *change(int val, int base,
char *retbuf){ static const char *str = "0123456789ABCDEF"; char *p; char
buf[15]; p = b...
分类:
编程语言 时间:
2014-06-12 10:09:57
阅读次数:
356
vector split(const string& src, const
string& separator){vectordest;string str = src;string
substring;string::size_type start = 0, index;do{index = st...
分类:
其他好文 时间:
2014-06-10 20:35:36
阅读次数:
238
前中后遍历 递归版 1 /* Recursive solution */ 2 class
Solution { 3 public: 4 vector preorderTraversal(TreeNode *root) { 5 6 vector
resul...
分类:
其他好文 时间:
2014-06-10 19:38:03
阅读次数:
219
水题,只要遍历一遍,不够平均数的,从后面的借,比平均数多的,把多余的数添加到后面即可,注意数据范围#include
#include #include using namespace std;int main(){ int n; cin >> n; vector
a(n); ...
分类:
其他好文 时间:
2014-06-10 12:42:12
阅读次数:
176
前言在上篇文章中提到了MySQL 5.6 Online DDL,如果是MySQL
5.5的版本在DDL方面是要付出代价的,虽然已经有了Fast index
Creation,但是在添加字段还是会锁表的,而且在添加删除辅助索引是会加S锁,也就是无法进行写操作。所以,这里就有相关工具的出现,那就是pt-...
分类:
其他好文 时间:
2014-06-10 11:32:56
阅读次数:
323
/*
* Created by SharpDevelop.
* User: Administrator
* Date: 2013/11/18
* Time: 20:55
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using Sy...
分类:
其他好文 时间:
2014-06-10 11:19:19
阅读次数:
1209