This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ test.cpp -static -o test -std=c++11 | |
// ./test | |
struct Foo | |
{ | |
Foo(); | |
} foo; | |
#include <iostream> | |
Foo::Foo() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ example.cpp -O2 -std=c++11 -o example | |
#include <cstdlib> | |
#include <string> | |
#include <chrono> | |
#include <thread> | |
#include <mutex> | |
#include <vector> | |
#include <functional> | |
#include <condition_variable> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <type_traits> | |
template<typename ... Args> | |
struct get_size; | |
template<> | |
struct get_size<> { | |
static constexpr int size = 0; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <utility> | |
template <typename T, T a, T b> | |
struct pair { | |
static constexpr auto first = a; | |
static constexpr auto second = b; | |
static void print() { std::cout << first << "->" << second << std::endl; } | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
using iochar = char; | |
using memval = unsigned char; | |
/* BF Memory Cell */ | |
template <memval val = 0> | |
struct Cell { | |
enum { value = val }; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# Author: 黄龑(huangyan13@baidu.com) | |
# Created Time: 2016/08/18 14:23 | |
# File Name: fast_patch.py | |
# Description: | |
# | |
# Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "divert_mem_pool.h" | |
#include <stdlib.h> | |
divert_mem_pool_t *divert_create_pool(size_t max_alloc) { | |
divert_mem_pool_t *pool = | |
calloc(sizeof(divert_mem_pool_t), 1); | |
if (pool == NULL) { | |
return NULL; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.3) | |
project(demo) | |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") | |
set(SOURCE_FILES demo.c) | |
# if you could not build successfully or error occured when importing nids |