11 #include <type_traits> 15 #include <glog/logging.h> 21 template<
class T,
class P>
43 ss <<
"accessing view with bounds [0, ";
45 ss <<
") at out-of-bounds index ";
47 throw std::out_of_range(ss.str());
54 ss <<
"accessing element in empty view with bounds [0, ";
57 throw std::out_of_range(ss.str());
79 inline operator std::vector<T>()
const {
98 return std::reverse_iterator<const_iterator>(
end());
102 return std::reverse_iterator<const_iterator>(
begin());
114 return std::reverse_iterator<const_iterator>(
cend());
118 return std::reverse_iterator<const_iterator>(
cbegin());
150 return m_data[
size() - 1];
184 DCHECK_LE(from,
size());
185 DCHECK_LE(to,
size());
203 *
this =
slice(0, m_size - n);
224 template<
class U,
class Q>
228 if (lhs.
size() != rhs.
size())
return false;
233 return !(
op_eq(lhs, rhs));
253 template<
class T,
class Q>
void bound_check_not_empty() const
static bool op_less_eq(const GenericViewBase< T, const T *> &lhs, const GenericViewBase< T, const T *> &rhs)
ptrdiff_t difference_type
Contains the text compression and encoding framework.
static bool op_eq(const GenericViewBase< T, const T *> &lhs, const GenericViewBase< T, const T *> &rhs)
void bound_check(size_t pos) const
void debug_bound_check_not_empty() const
bool starts_with(const GenericViewBase< T, const T *> &x) const
const_reference back() const
void remove_suffix(size_type n)
const_iterator cend() const
void remove_prefix(size_type n)
const_reverse_iterator rbegin() const
static bool op_less(const GenericViewBase< T, const T *> &lhs, const GenericViewBase< T, const T *> &rhs)
const_iterator begin() const
void swap(GenericViewBase &other)
const_reference front() const
static bool op_not_eq(const GenericViewBase< T, const T *> &lhs, const GenericViewBase< T, const T *> &rhs)
GenericViewBase(const std::array< T, N > &other)
GenericViewBase & operator=(const GenericViewBase &other)
const Sindex * const_pointer
const_reference at(size_type n) const
size_type max_size() const
static bool op_greater_eq(const GenericViewBase< T, const T *> &lhs, const GenericViewBase< T, const T *> &rhs)
const_reference operator[](size_type n) const
std::reverse_iterator< const_iterator > const_reverse_iterator
void swap(GenericViewBase< T, Q > &lhs, GenericViewBase< T, Q > &rhs)
const_iterator end() const
static const size_type npos
GenericViewBase(P data, size_t size)
const_reverse_iterator crbegin() const
bool ends_with(const T &c) const
const_iterator cbegin() const
GenericViewBase slice(size_type from, size_type to=npos) const
const_reverse_iterator crend() const
GenericViewBase(const std::vector< T > &other)
void debug_bound_check(size_t IF_DEBUG(pos)) const
const_pointer const_iterator
bool starts_with(const T &c) const
bool ends_with(const GenericViewBase< T, const T *> &x) const
const value_type * data() const noexcept
GenericViewBase(const GenericViewBase &other)
static bool op_greater(const GenericViewBase< T, const T *> &lhs, const GenericViewBase< T, const T *> &rhs)
const Sindex & const_reference
GenericViewBase substr(size_type pos, size_type len=npos) const
const_reverse_iterator rend() const
#define IF_DEBUG(x)
x is compiled only in debug builds.