use std::move to pass arr and map
use unique_ptr instead of shared_ptr
fix
add lib functions