view: prefer construction using explicit size over pointer arithmetic

This simplifies step through debugging on some containers.
This commit is contained in:
Danny Robson 2018-10-04 15:36:35 +10:00
parent 591a321f47
commit c383f6579f

View File

@ -186,7 +186,7 @@ namespace cruft {
//---------------------------------------------------------------------
template <typename ValueT, typename AllocatorT>
view (const std::vector<ValueT,AllocatorT> &rhs):
view (std::data (rhs), std::data (rhs) + std::size (rhs))
view (std::data (rhs), std::size (rhs))
{ ; }
@ -207,7 +207,7 @@ namespace cruft {
//---------------------------------------------------------------------
template <typename ValueT, std::size_t N>
view (const std::array<ValueT,N> &rhs):
view (std::data (rhs), std::data (rhs) + std::size (rhs))
view (std::data (rhs), std::size (rhs))
{ ; }