C++-Primer
ngo tong
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
c++ associative container: map and set
#include <map>#include <set>#include <string>#include <iostream>#include <algorithm>#include <functional>#include <locale>void rightTrimPunct(std::string &str){ std::locale locl("C");原创 2015-12-06 11:27:55 · 467 阅读 · 0 评论 -
C++11: variadic template
#include <iostream>#include <string>template <typename T, typename... Args>void foo(const T &t, const Args& ... rest){ std::cout << sizeof...(Args) << std::endl; std::cout << sizeof.转载 2015-12-18 10:05:48 · 565 阅读 · 0 评论 -
C++11: forwarding parameter packs and define my own version of make_shared
forwarding paramerter packs原创 2015-12-18 10:54:14 · 509 阅读 · 0 评论 -
C++11: tuple
<tuple>转载 2015-12-18 15:01:05 · 467 阅读 · 0 评论 -
C++11: bitset
bitset转载 2015-12-18 16:38:37 · 963 阅读 · 0 评论 -
C++11: regex #1
regex转载 2015-12-18 18:46:44 · 449 阅读 · 0 评论 -
C++11: regex #2
regex; matched; str()转载 2015-12-18 19:14:01 · 408 阅读 · 0 评论 -
C++11: regex #3
regex_place转载 2015-12-18 22:30:18 · 419 阅读 · 0 评论 -
C++11: random #1
std::uniform_int_distribution; std::default_random_engine转载 2015-12-19 10:31:29 · 429 阅读 · 0 评论 -
C++11: random #2
normal_distribution; uniform_real_distribution; lround转载 2015-12-19 11:13:14 · 615 阅读 · 0 评论 -
C++11: inherited constructors
#include <string>#include <iostream>class Quote {public: Quote() = default; Quote(const std::string &book, double sales_price) : bookNo(book), price(sales_price) {}转载 2015-12-17 11:41:21 · 965 阅读 · 0 评论 -
C++11: std::forward
using std::forward to preserve type information in a call转载 2015-12-17 22:44:33 · 487 阅读 · 0 评论 -
C++11: default template arguments for both function and class templates
#include <functional>#include <iostream>template <typename T, typename F = std::less<T>>int compare(const T &v1, const T &v2, F f = F()){ if (f(v1, v2)) return -1; if (f(v2, v1)) re转载 2015-12-17 17:40:17 · 514 阅读 · 0 评论 -
C++ lambda algorithm
std::stable_sort(words.begin(), words.end(), [](const std::string &left, const std::string &right) { return left.size() < right.size(); });转载 2015-11-26 22:30:16 · 610 阅读 · 0 评论 -
C++ algorithm partition
#include <vector>#include <string>#include <algorithm>#include <iterator>#include <iostream>// function that take a string and return true// indicating the string has five characters // or moreb原创 2015-11-19 23:15:29 · 1251 阅读 · 0 评论 -
C++ back_inserter
#include <iostream>#include <iterator>#include <vector>// g++ 4.9.2 x86_64int main(){ std::vector<int> vec; auto it = back_inserter(vec); // assigning through it adds elements to vec转载 2015-11-16 23:05:06 · 1445 阅读 · 0 评论 -
C++11: unordered_map
std::unordered_map原创 2015-12-15 11:40:25 · 529 阅读 · 0 评论 -
C++11: smart pointer
std::shared_ptr<std::vector<std::string> > data; void check(size_type i, const std::string &msg) const;原创 2015-12-15 16:16:25 · 503 阅读 · 0 评论 -
c++: allocator, uninitialized_copy, uninitialized_fill_n
#include <memory>#include <iostream>#include <vector>int main(){ std::vector<int> vi{1, 3, 5, 7}; std::allocator<int> alloc; auto p = alloc.allocate(vi.size() * 2);转载 2015-12-16 11:13:18 · 1111 阅读 · 0 评论 -
c++11: allocator construct
#include <memory>#include <string>#include <iostream>int main(){ const int n = 10; std::allocator<std::string> alloc; auto const p = alloc.allocate(n); auto q = p;转载 2015-12-16 10:45:20 · 1407 阅读 · 0 评论 -
C++11: function type
std::function<int (int, int)>转载 2015-12-16 19:58:11 · 1187 阅读 · 0 评论 -
C++11: deleted copy control
// Because the copy constructor is defined, the compiler will not syn-// thesize a move constructor for class B. As a result, we can neithe-// r move nor copy objects of type B. If a class derived fr转载 2015-12-17 10:53:18 · 389 阅读 · 0 评论 -
C++11: Dynamic Memory
C++11; shared_ptr转载 2016-01-13 17:08:14 · 895 阅读 · 0 评论
分享