diff options
Diffstat (limited to 'src/lib/netlist/plib/parray.h')
-rw-r--r-- | src/lib/netlist/plib/parray.h | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/lib/netlist/plib/parray.h b/src/lib/netlist/plib/parray.h index a1e3c2c504a..6570c8e592f 100644 --- a/src/lib/netlist/plib/parray.h +++ b/src/lib/netlist/plib/parray.h @@ -70,6 +70,32 @@ namespace plib { { } + template <int X = SIZE > + parray(size_type size, FT val, typename std::enable_if<(X==0), int>::type = 0) + : m_a(size, val), m_size(size) + { + } + + template <int X = SIZE > + parray(size_type size, typename std::enable_if<(X != 0), int>::type = 0) + : m_size(size) + { + if ((SIZE < 0 && size > SIZEABS()) + || (SIZE > 0 && size != SIZEABS())) + throw plib::pexception("parray: size error " + plib::to_string(size) + ">" + plib::to_string(SIZE)); + } + + template <int X = SIZE > + parray(size_type size, FT val, typename std::enable_if<(X != 0), int>::type = 0) + : m_size(size) + { + if ((SIZE < 0 && size > SIZEABS()) + || (SIZE > 0 && size != SIZEABS())) + throw plib::pexception("parray: size error " + plib::to_string(size) + ">" + plib::to_string(SIZE)); + m_a.fill(val); + } + + /* allow construction in fixed size arrays */ parray() : m_size(SIZEABS()) @@ -96,15 +122,6 @@ namespace plib { ~parray() noexcept = default; - template <int X = SIZE > - parray(size_type size, typename std::enable_if<(X != 0), int>::type = 0) - : m_size(size) - { - if ((SIZE < 0 && size > SIZEABS()) - || (SIZE > 0 && size != SIZEABS())) - throw plib::pexception("parray: size error " + plib::to_string(size) + ">" + plib::to_string(SIZE)); - } - base_type &as_base() noexcept { return m_a; } inline size_type size() const noexcept { return SIZE <= 0 ? m_size : SIZEABS(); } |