![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++11
文章平均质量分 74
ych19871020
这个作者很懒,什么都没留下…
展开
-
c++11 右值引用
右值引用是一种复合类型,跟C++的传统引用很类似。为更准确地区分两种类型,我们把传统的C++引用称为左值引用。而使用“引用”这一术语时,我们的意思同时包含两种引用:左值引用和右值引用。 右值引用的行为跟左值引用类似,不同之处在于:右值引用可以绑定到临时量(右值),而(非const的)左值引用却不能绑定到右值。 究竟为何要使用右值引用? 右值引用和左值引用结合起来恰能方便地实现转移语义。原创 2013-10-14 20:28:41 · 454 阅读 · 0 评论 -
c++求数组大小
每次看到c++的奇技淫巧都觉得这门语言过于复杂庞大,可有时会忍不住去学习,今天学到一个c++判断数组大小,写下做纪念 在c中判断数组大小经常用 #define num(x) sizeof(x)/sizeof(0[x])注意这里用0[x]作用是防止自定义类型计算,但我们用一个指针指向一个数组时。比如int a[2];int *p=a; num(p) 计算会得到1,但这不是我们要的结果,既然不是我原创 2014-03-25 23:44:23 · 2225 阅读 · 0 评论 -
leetcode Add and Search Word - Data structure design
很久没刷题,再次面对trie居然没有第一时间想起来 Design a data structure that supports the following two operations: void addWord(word) bool search(word) search(word) can search a literal word or a regular express原创 2015-05-17 21:14:31 · 369 阅读 · 0 评论 -
leetcode Anagrams
Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. 这个是找出所有的回购词 #include #include #include #include #include #include原创 2015-05-18 14:48:40 · 326 阅读 · 0 评论