11 #include <type_traits> 15 #include <glog/logging.h> 37 using Super::op_not_eq;
38 using Super::op_greater;
39 using Super::op_greater_eq;
41 using Super::op_less_eq;
80 inline operator std::vector<uliteral_t>()
const {
81 return Super::operator std::vector<uliteral_t>();
86 return Super::begin();
96 return Super::rbegin();
101 return Super::rend();
106 return Super::cbegin();
111 return Super::cend();
116 return Super::crbegin();
121 return Super::crend();
126 return Super::size();
131 return Super::max_size();
136 return Super::empty();
143 return Super::operator[](pos);
150 return Super::at(pos);
155 return Super::front();
160 return Super::back();
165 return Super::data();
222 return Super::remove_prefix(n);
227 return Super::remove_suffix(n);
232 return Super::starts_with(other);
238 return Super::starts_with(other);
243 return Super::ends_with(other);
249 return Super::ends_with(other);
259 friend bool operator<(const ConstGenericView<uliteral_t>& lhs,
261 friend bool operator<=(const ConstGenericView<uliteral_t>& lhs,
285 inline operator std::string()
const {
286 return std::string(cbegin(), cend());
301 inline bool operator<(const ConstGenericView<uliteral_t>& lhs,
306 inline bool operator<=(const ConstGenericView<uliteral_t>& lhs,
323 os.write((
const char*) v.
data(), v.
size());
typename Super::const_reference const_reference
bool operator!=(const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs)
ptrdiff_t difference_type
Contains the text compression and encoding framework.
void pop_front()
Remove the first element from the View.
bool ends_with(const ConstGenericView< uliteral_t > &other) const
Returns true if the View ends with the sequence of literals contained in other.
A view into a slice of memory.
ConstGenericView substr(size_type pos, size_type len=npos) const
Construct a new View that is a sub view into the current one.
void pop_back()
Remove the last element from the View.
A const view into a slice of memory.
ConstGenericView()
Construct a empty View.
uint8_t uliteral_t
Type to represent signed single literals.
const_reverse_iterator crend() const
End of const reverse iterator.
bool operator==(const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs)
std::ostream & operator<<(std::ostream &os, const ConstGenericView< uliteral_t > &v)
bool starts_with(const uliteral_t &other) const
Returns true if the View starts with the literal other
bool operator>=(const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs)
ConstGenericView(const std::vector< uliteral_t > &other)
Construct a View pointing at the contents of a vector.
size_type size() const
Returns size of the View.
void clear()
Sets the size to 0.
bool ends_with(const uliteral_t &other) const
Returns true if the View ends with the literal other
size_type max_size() const
Returns max size of the View. Always the same as size()
const_reverse_iterator rend() const
End of reverse iterator.
ConstGenericView(const char *data, size_t len)
Construct a View pointing at len elements starting from data
ConstGenericView(const uliteral_t *data, size_t len)
Construct a View pointing at len elements starting from data
ConstGenericView(const char *other)
Construct a View pointing at a C-style null terminated string.
const_iterator end() const
End of iterator.
typename Super::size_type size_type
typename Super::value_type value_type
const_reference operator[](size_type pos) const
Access the element at pos
ConstGenericView(const ConstGenericView &other)
Construct a View as a copy of other
const uliteral_t * const_pointer
void swap(ConstGenericView &other)
Swap two Views.
void swap(IntVector< T > &lhs, IntVector< T > &rhs)
const_iterator begin() const
Begin of iterator.
std::reverse_iterator< const_iterator > const_reverse_iterator
ConstGenericView slice(size_type from, size_type to=npos) const
Construct a new View that is a sub view into the current one.
const_reverse_iterator rbegin() const
Begin of reverse iterator.
ConstGenericView(const GenericView< uliteral_t > &other)
Construct a View as a copy of other
ConstGenericView(const std::array< uliteral_t, N > &other)
Construct a View pointing at the contents of a array.
const_iterator cend() const
End of const iterator.
const_reference front() const
Access the first element.
typename Super::difference_type difference_type
void remove_suffix(size_type n)
Removes the last n elements from the View.
bool starts_with(const ConstGenericView< uliteral_t > &other) const
Returns true if the View starts with the sequence of literals contained in other. ...
const value_type * data() const noexcept
The backing memory location.
bool empty() const
Returns true if empty.
const_reference at(size_type pos) const
Access the element at pos
const_reverse_iterator crbegin() const
Begin of const reverse iterator.
ConstGenericView()
Construct a empty View.
ConstGenericView(const std::string &other)
Construct a View pointing at the contents of a string.
const_pointer const_iterator
typename Super::const_pointer const_pointer
typename Super::const_iterator const_iterator
const_iterator cbegin() const
Begin of const iterator.
bool operator>(const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs)
typename Super::const_reverse_iterator const_reverse_iterator
A const view into a slice of memory.
const uliteral_t & const_reference
const_reference back() const
Access the last element.
void remove_prefix(size_type n)
Removes the first n elements from the View.