rewrite with STL and boost