iterator,string: add size queries
This commit is contained in:
parent
6f45f9514d
commit
db24df329f
@ -297,6 +297,11 @@ namespace util {
|
||||
iterator begin (void) const { return iterator { value_type {0} }; }
|
||||
iterator end (void) const { return iterator { value_type (m_container.size ()) }; }
|
||||
|
||||
constexpr auto size (void) const noexcept
|
||||
{
|
||||
return std::size (m_container);
|
||||
}
|
||||
|
||||
private:
|
||||
const ContainerT &m_container;
|
||||
};
|
||||
|
10
string.hpp
10
string.hpp
@ -127,6 +127,16 @@ namespace util {
|
||||
iterator cend (void) const { return { { m_range.cend (), m_range.cend () }, m_separator }; }
|
||||
iterator end (void) const { return { { m_range.cend (), m_range.cend () }, m_separator }; }
|
||||
|
||||
std::size_t
|
||||
size (void) const
|
||||
{
|
||||
return std::count (
|
||||
m_range.begin (),
|
||||
m_range.end (),
|
||||
m_separator
|
||||
) + 1u;
|
||||
}
|
||||
|
||||
private:
|
||||
const range_type m_range;
|
||||
const value_type m_separator;
|
||||
|
Loading…
Reference in New Issue
Block a user