Clone this repository:
git clone https://gist.github.com/0c6f5f31f874d39e0860c48fd4b575e8.git docker-profanity
cd docker-profanity
and then run following command to build the image:
This example demonstrates how to implement boost::asio
handler
callback as a member functions in a safe way, even while the ASIO
timer or socket object is itself also contained in the same object.
When deleting the object containing both the handler method and ASIO
#include <boost/exception/diagnostic_information.hpp> | |
struct MyException : virtual boost::exception, virtual std::exception | |
{ | |
virtual const char* what() const throw() { return boost::diagnostic_information_what(*this); } | |
}; |
// clang++ -Wall -std=c++11 -O0 -o scope-exit scope-exit.cpp && ./scope-exit | |
// g++ -Wall -std=c++11 -O0 -o scope-exit scope-exit.cpp && ./scope-exit | |
#include <iostream> | |
template <typename F> | |
struct ScopeExit | |
{ | |
ScopeExit(F f) : f(f) {} | |
~ScopeExit() { f(); } |
// clang++ -Wall -std=c++11 -O0 -o test test.cpp && ./test | |
// g++ -Wall -std=c++11 -O0 -o test test.cpp && ./test | |
#include <iostream> | |
#include <vector> | |
#include <cstdio> | |
namespace Ns | |
{ |
/* | |
## Compile | |
g++ -Wall -std=c++11 -rdynamic -g stack-backtrace.cpp -lbacktrace -o stack-backtrace && ./stack-backtrace | |
clang++ -Wall -std=c++11 -rdynamic -g stack-backtrace.cpp -lbacktrace -o stack-backtrace && ./stack-backtrace | |
## Output | |
Backtrace: |
#!/bin/bash | |
# | |
# To make apache render files ending with .md with strapdown.js | |
# markdown renderer (http://strapdownjs.com/), add following lines | |
# to /etc/apache2/httpd.conf: | |
# | |
# Action markdown /cgi-bin/strapdown.cgi | |
# AddHandler markdown .md | |
# DirectoryIndex index.html index.md | |
# |