design pattern based on c++11