现整理收集C++世界里那些“牛人”的个人博客。凡三类:一是令人高山仰止的大牛,对C++语言本身产生过深远的影响的人;二是C++运用炉火纯青的高手,有原创性的技术干货;三是中文世界里的C++牛人。
- Bjarne Stroustrup的博客: Bjarne Stroustrup’s Homepage
#include <lzma.h> // http://tukaani.org/xz/ | |
#include <memory> // unique_ptr | |
#include <stdexcept> // runtime_error | |
#include <glim/gstring.hpp> // Here glim::gstring can be replaced with std::string. | |
using glim::gstring; | |
static void xzCompress (const gstring& from, gstring& to) { | |
// See also LZMA example at: http://git.tukaani.org/?p=xz.git;a=blob;f=doc/examples/01_compress_easy.c | |
lzma_stream strm = LZMA_STREAM_INIT; | |
std::unique_ptr<lzma_stream, void(*)(lzma_stream*)> freeStream (&strm, lzma_end); |
#include <asio.hpp> | |
#include <asio/ssl.hpp> | |
#include <algorithm> | |
#include <atomic> | |
#include <cstdlib> | |
#include <ctime> | |
#include <iostream> | |
#include <memory> | |
#include <thread> |
// | |
// client.cpp | |
// ~~~~~~~~~~ | |
// | |
// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) | |
// | |
// Distributed under the Boost Software License, Version 1.0. (See accompanying | |
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
// |
现整理收集C++世界里那些“牛人”的个人博客。凡三类:一是令人高山仰止的大牛,对C++语言本身产生过深远的影响的人;二是C++运用炉火纯青的高手,有原创性的技术干货;三是中文世界里的C++牛人。
all:consumer producer | |
CPPFLAGS+=-std=c++03 -Wall -pedantic | |
CPPFLAGS+=-g -O0 | |
CPPFLAGS+=-isystem ~/custom/boost/ | |
LDFLAGS+=-L ~/custom/boost/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost/stage/lib | |
LDFLAGS+=-lboost_system -lrt -lpthread | |
%:%.cpp |
// generate [0..n-1] | |
auto seq = [](size_t n) -> std::vector<size_t> { | |
std::vector<size_t> v(n); | |
for (size_t i=0; i<n; ++i) v[i] = i; | |
return v; | |
}; | |
auto index = seq(n); | |
// n * n distance matrix | |
std::vector<D> dists(n * n); |