11 #include <type_traits> 15 #include <glog/logging.h> 39 using Super::op_not_eq;
40 using Super::op_greater;
41 using Super::op_greater_eq;
43 using Super::op_less_eq;
54 static const size_type npos = Super::npos;
82 inline operator std::vector<T>()
const {
83 return Super::operator std::vector<T>();
88 return Super::begin();
98 return Super::rbegin();
103 return Super::rend();
108 return Super::cbegin();
113 return Super::cend();
118 return Super::crbegin();
123 return Super::crend();
127 inline size_type
size()
const {
128 return Super::size();
133 return Super::max_size();
138 return Super::empty();
145 return Super::operator[](pos);
152 return Super::at(pos);
157 return Super::front();
162 return Super::back();
167 return Super::data();
224 return Super::remove_prefix(n);
229 return Super::remove_suffix(n);
234 return Super::starts_with(other);
240 return Super::starts_with(other);
245 return Super::ends_with(other);
251 return Super::ends_with(other);
264 friend bool operator<(const ConstGenericView<U>& lhs,
267 friend bool operator<=(const ConstGenericView<U>& lhs,
310 return swap((Super&) lhs, (Super&) rhs);
317 struct hash<
tdc::ConstGenericView<T>>
320 std::size_t seed = 0;
322 for (
const auto& v : x) {
323 seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
ptrdiff_t difference_type
Contains the text compression and encoding framework.
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
bool ends_with(const T &other) const
Returns true if the View ends with the literal other
void pop_front()
Remove the first element from the View.
bool ends_with(const ConstGenericView< T > &other) const
Returns true if the View ends with the sequence of literals contained in other.
const_reverse_iterator crend() const
End of const reverse iterator.
A view into a slice of memory.
A const view into a slice of memory.
ConstGenericView()
Construct a empty View.
bool starts_with(const ConstGenericView< T > &other) const
Returns true if the View starts with the sequence of literals contained in other. ...
bool operator>(const ConstGenericView< T > &lhs, const ConstGenericView< T > &rhs)
ConstGenericView(const T *data, size_t len)
Construct a View pointing at len elements starting from data
void swap(ConstGenericView &other)
Swap two Views.
ConstGenericView(const std::vector< T > &other)
Construct a View pointing at the contents of a vector.
void remove_prefix(size_type n)
Removes the first n elements from the View.
const_reference at(size_type pos) const
Access the element at pos
size_type size() const
Returns size of the View.
ConstGenericView(const ConstGenericView &other)
Construct a View as a copy of other
ConstGenericView(const GenericView< T > &other)
Construct a View as a copy of other
ConstGenericView 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< T > &lhs, const ConstGenericView< T > &rhs)
const Sindex * const_pointer
const_reverse_iterator rbegin() const
Begin of reverse iterator.
const_reference operator[](size_type pos) const
Access the element at pos
ConstGenericView(const std::array< T, N > &other)
Construct a View pointing at the contents of a array.
const_iterator cbegin() const
Begin of const iterator.
ConstGenericView slice(size_type from, size_type to=npos) const
Construct a new View that is a sub view into the current one.
std::reverse_iterator< const_iterator > const_reverse_iterator
void remove_suffix(size_type n)
Removes the last n elements from the View.
size_t operator()(const tdc::ConstGenericView< T > &x) const
void clear()
Sets the size to 0.
bool operator!=(const ConstGenericView< T > &lhs, const ConstGenericView< T > &rhs)
bool operator==(const ConstGenericView< T > &lhs, const ConstGenericView< T > &rhs)
const value_type * data() const noexcept
The backing memory location.
void pop_back()
Remove the last element from the View.
bool empty() const
Returns true if empty.
const_pointer const_iterator
const_reverse_iterator rend() const
End of reverse iterator.
const_iterator begin() const
Begin of iterator.
const_iterator cend() const
End of const iterator.
const_iterator end() const
End of iterator.
const Sindex & const_reference
const_reverse_iterator crbegin() const
Begin of const reverse iterator.
const_reference back() const
Access the last element.
size_type max_size() const
Returns max size of the View. Always the same as size()
void swap(ConstGenericView< T > &lhs, ConstGenericView< T > &rhs)