Skip to content

Instantly share code, notes, and snippets.

all: test
CXX=clang++
CPPFLAGS=-std=c++14 -O2 -Wall -pedantic -march=native
#CPPFLAGS+=-fsanitize=address,undefined
CPPFLAGS+=-I ~/custom/boost
test: main.o identifier.o enum.o
$(CXX) $(CPPFLAGS) -o $@ $^ $(LDFLAGS)
@sehe
sehe / CMakeLists.txt
Last active December 2, 2016 22:18
old fashioned grammar struct; using X3
ADD_EXECUTABLE(demo test.cpp b.cpp)
SET(CMAKE_CXX_COMPILER g++-5)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-std=c++1z \
-g0 -O3 -pthread -march=native")
#-fsanitize=undefined,address
#-DBOOST_SPIRIT_X3_DEBUG=1 \
@sehe
sehe / main.cpp
Created November 22, 2016 21:50 — forked from chenfengyuan/main.cpp
boost use callback functions in stackfull coroutine
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/asio/spawn.hpp>
#include <memory>
void bar(boost::asio::io_service &io, std::function<void()> cb){
auto ptr = std::make_shared<boost::asio::deadline_timer>(io, boost::posix_time::seconds(1));
ptr->async_wait([ptr, cb](const boost::system::error_code&){cb();});
}
#include "AbstractPoint.h"
#include <boost/serialization/export.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
BOOST_CLASS_EXPORT_IMPLEMENT(AbstractPoint)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Command: ./test Command: ./test
Massif arguments: (none) Massif arguments: (none)
ms_print arguments: massif.out.12835 | ms_print arguments: massif.out.8577
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
GB GB
1.604^ # | 2.660^ #
| :@:# | | :::@::::#
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Command: ./test Command: ./test
Massif arguments: (none) Massif arguments: (none)
ms_print arguments: massif.out.12835 | ms_print arguments: massif.out.17227
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
GB GB
1.604^ # | 1.605^ :
| :@:# | | :###################################################################:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
@sehe
sehe / mutable_wrapper.hpp
Created January 19, 2016 08:55
mutable_wrapper
#include <vector>
#include <iterator>
struct X {
X() = default;
X(X&&) = default;
X(X const&) = delete;
};
template<typename Val>
@sehe
sehe / 1.mini
Last active December 10, 2015 17:16
Extending MINIC
/* My first mini program */
var pow2(n)
{
var a = 2;
var i = 1;
while (i < n)
{
a = a * 2;
i = i + 1;
@sehe
sehe / ast.hpp
Created December 10, 2015 17:14
Extending MINIC
//