view: add assertion that orderable iterators are ordered
This commit is contained in:
parent
c533b4103e
commit
e7ba296011
16
view.hpp
16
view.hpp
@ -22,6 +22,7 @@
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace cruft {
|
||||
template <typename BeginT, typename EndT = BeginT>
|
||||
@ -42,7 +43,11 @@ namespace cruft {
|
||||
view (const BeginT &first, const EndT &last) noexcept:
|
||||
m_begin (first),
|
||||
m_end (last)
|
||||
{ ; }
|
||||
{
|
||||
if constexpr (cruft::is_orderable_v<BeginT> && cruft::is_orderable_v<EndT>) {
|
||||
CHECK_LE (m_begin, m_end);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <
|
||||
@ -97,8 +102,10 @@ namespace cruft {
|
||||
>
|
||||
>
|
||||
view (const view<const ValueT*const*,const ValueT*const*> &rhs):
|
||||
m_begin (const_cast<const ValueT**> (rhs.begin ())),
|
||||
m_end (const_cast<const ValueT**> (rhs.end ()))
|
||||
view (
|
||||
const_cast<const ValueT**> (rhs.begin ()),
|
||||
const_cast<const ValueT**> (rhs.end ())
|
||||
)
|
||||
{ ; }
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
@ -111,8 +118,7 @@ namespace cruft {
|
||||
>
|
||||
>
|
||||
view (const view<ValueT*,ValueT*> &rhs):
|
||||
m_begin (rhs.begin ()),
|
||||
m_end (rhs.end ())
|
||||
view (rhs.begin (), rhs.end ())
|
||||
{ ; }
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user