#include
template
void F(Ts&& ... params) {
printf(std::forward(params)...);
}
int main()
{
auto f = [] { printf("hello world"); };
f();
F("%s: %d", __FUNCTION__, __LINE__);
return...
分类:
编程语言 时间:
2015-07-24 16:12:39
阅读次数:
292
Sort函数:
sort函数的头文件
#include
using namespace std;
bool cmp(int a, int b)
{
//return ab,则为降序(理解为先排大的,后排小的)
return a > b;
}
Qsort函数对double类型排序
int cmp(const void *a, const void *b)
{
//从大到小排序
...
分类:
其他好文 时间:
2015-07-24 16:08:58
阅读次数:
108
1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int gcd(int a,int b) 8 { 9 if(b==0)10 return a;11 else12 r...
分类:
其他好文 时间:
2015-07-24 16:06:26
阅读次数:
133
原题如下:
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to a...
分类:
其他好文 时间:
2015-07-24 13:00:00
阅读次数:
132
Given a sorted integer array without duplicates, return the summary of its ranges.
For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].
本题我采用的是最直观的算法,但整数转化为字符还有些坎坷。应该还有简单的算法,但目前没有时间去研究了。...
分类:
其他好文 时间:
2015-07-24 12:56:25
阅读次数:
109
使用EasyUI加载服务端返回的数据时常用 $('#fm').form('load', row); 实现,既方便又简洁,但是,当Form中包含有FileBox时,代码就会报错,经过跟踪发现,因为EasyUI试图向隐藏的文件标签赋值,导致了错误。其源代码如下:
initValue: function(jq, _4d9) {
return jq.each(function() {
var _4...
分类:
其他好文 时间:
2015-07-24 12:47:37
阅读次数:
255
//缩放- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{ //返回要缩放的视图 return self.rv.imV;}//- (void)scrollViewDidScroll:(UIScrollView *)sc...
分类:
其他好文 时间:
2015-07-24 12:21:45
阅读次数:
92
让它的状态只能看不能改变,加上onclick="return false;".也可以disabled="true";但是这个颜色变淡了; checked="checked" />
分类:
其他好文 时间:
2015-07-24 12:13:36
阅读次数:
95
/** * 去除千分符 */function commafyback(num) { var x = num.split(','); return parseFloat(x.join(""));}/** * 增加千分符 */function commafy(num) { num = ...
分类:
Web程序 时间:
2015-07-24 12:07:06
阅读次数:
169
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...
分类:
其他好文 时间:
2015-07-24 12:02:03
阅读次数:
78