123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #ifndef BOOST_MP_DETAIL_STATIC_ARRAY_HPP
- #define BOOST_MP_DETAIL_STATIC_ARRAY_HPP
- #include <array>
- #include <cstddef>
- #include <cstdint>
- #include <initializer_list>
- namespace boost { namespace multiprecision { namespace backends { namespace detail {
- template <class ValueType, const std::uint32_t ElemNumber>
- struct static_array : public std::array<ValueType, std::size_t(ElemNumber)>
- {
- private:
- using base_class_type = std::array<ValueType, std::size_t(ElemNumber)>;
- public:
- static_array() noexcept
- {
- base_class_type::fill(typename base_class_type::value_type(0u));
- }
- static_array(std::initializer_list<std::uint32_t> lst) noexcept
- {
- std::copy(lst.begin(),
- lst.begin() + (std::min)(std::size_t(lst.size()), std::size_t(ElemNumber)),
- base_class_type::begin());
- std::fill(base_class_type::begin() + (std::min)(std::size_t(lst.size()), std::size_t(ElemNumber)),
- base_class_type::end(),
- typename base_class_type::value_type(0u));
- }
- };
- }}}}
- #endif
|