The weight have a template type. It should works with std::vector or boost::array, ...
Change the type of nbr_digit to std::size_t because it's more appropriate than unsigned int for a size.