11 #include <type_traits> 15 #include <glog/logging.h> 31 class GenericView: GenericViewBase<T, T*> {
78 inline operator std::vector<T>()
const {
79 return Super::operator std::vector<T>();
109 return std::reverse_iterator<iterator>(
end());
119 return std::reverse_iterator<iterator>(
begin());
310 return swap((Super&) lhs, (Super&) rhs);
409 return hash<tdc::ConstGenericView<T>>()(x);
const_reverse_iterator rbegin() const
Begin of reverse iterator.
GenericView substr(size_type pos, size_type len=npos) const
Construct a new View that is a sub view into the current one.
bool operator!=(const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs)
ptrdiff_t difference_type
Contains the text compression and encoding framework.
const_reverse_iterator crbegin() const
Begin of const reverse iterator.
void bound_check(size_t pos) const
static const size_type npos
Sentinel value indicating a index at the end of the view.
GenericView(const GenericView &other)
Construct a View as a copy of other
void swap(GenericView &other)
Swap two Views.
A view into a slice of memory.
void debug_bound_check_not_empty() const
A const view into a slice of memory.
const_reference back() const
const_iterator begin() const
Begin of iterator.
GenericView(T *data, size_t len)
Construct a View pointing at len elements starting from data
void remove_suffix(size_type n)
bool operator==(const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs)
reference at(size_type n)
Access the element at pos
size_t operator()(const tdc::GenericView< T > &x) const
reference back()
Access the last element.
bool operator>=(const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs)
const_iterator cend() const
const_iterator cend() const
End of const iterator.
reference operator[](size_type n)
Access the element at pos
void remove_prefix(size_type n)
bool ends_with(const ConstGenericView< T > &other) const
Returns true if the View ends with the sequence of literals contained in other.
reference front()
Access the first element.
const_reference at(size_type pos) const
Access the element at pos
value_type * data() noexcept
The backing memory location.
size_type size() const
Returns size of the View.
const_reverse_iterator rbegin() const
GenericView slice(size_type from, size_type to=npos) const
Construct a new View that is a sub view into the current one.
const_iterator begin() const
void swap(GenericViewBase &other)
iterator end()
End of iterator.
const_reference front() const
typename Super::size_type size_type
void clear()
Sets the size to 0.
void pop_back()
Remove the last element from the View.
GenericView()
Construct a empty View.
const value_type * data() const noexcept
The backing memory location.
const_reference at(size_type n) const
size_type max_size() const
const_reference back() const
Access the last element.
const_reference operator[](size_type n) const
bool starts_with(const ConstGenericView< T > &other) const
Returns true if the View starts with the sequence of literals contained in other. ...
void pop_front()
Remove the first element from the View.
std::reverse_iterator< const_iterator > const_reverse_iterator
const_reference front() const
Access the first element.
bool starts_with(const T &other) const
Returns true if the View starts with the literal other
iterator begin()
Begin of iterator.
const_iterator end() const
static const size_type npos
size_type max_size() const
Returns max size of the View. Always the same as size()
bool ends_with(const T &other) const
Returns true if the View ends with the literal other
std::reverse_iterator< iterator > reverse_iterator
const_reference operator[](size_type pos) const
Access the element at pos
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
reverse_iterator rbegin()
Begin of reverse iterator.
reverse_iterator rend()
End of reverse iterator.
void debug_bound_check(size_t IF_DEBUG(pos)) const
const_pointer const_iterator
void remove_suffix(size_type n)
Removes the last n elements from the View.
bool empty() const
Returns true if empty.
const_reverse_iterator rend() const
End of reverse iterator.
bool starts_with(const T &c) const
GenericView(std::array< uliteral_t, N > &other)
Construct a View pointing at the contents of a array.
GenericView(std::vector< T > &other)
Construct a View pointing at the contents of a vector.
const_iterator end() const
End of iterator.
const value_type * data() const noexcept
void remove_prefix(size_type n)
Removes the first n elements from the View.
bool operator>(const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs)
friend class GenericViewBase< T, T *>
const_iterator cbegin() const
Begin of const iterator.
const T & const_reference
GenericViewBase substr(size_type pos, size_type len=npos) const
const_reverse_iterator crend() const
End of const reverse iterator.
const_reverse_iterator rend() const