array/varray: allow construction from containers

This commit is contained in:
Danny Robson 2019-02-10 13:10:46 +11:00
parent 2f6c845409
commit 7746463c5a

View File

@ -40,13 +40,22 @@ namespace cruft {
: m_data (std::data (rhs))
{ ; }
varray (std::array<T,S> &&) = delete;
//-------------------------------------------------------------------------
varray (T (&_data)[S])
: m_data (_data)
{ ; }
template <typename ContainerT>
varray (ContainerT &_container)
: varray (_container.data ())
{ CHECK_GE (_container.size (), size ()); }
//---------------------------------------------------------------------
std::size_t size (void) const { return S; }