rewrite with c++ style and boost