string: tokeniser value_type should be view<Iterator>

This commit is contained in:
Danny Robson 2019-06-20 16:31:22 +10:00
parent 9243f259e2
commit e0350f912b

View File

@ -37,11 +37,10 @@ namespace cruft {
template <typename Iterator> template <typename Iterator>
struct tokeniser { struct tokeniser {
public: public:
using value_type = typename std::iterator_traits<Iterator>::value_type; using value_type = view<Iterator>;
using range_type = view<Iterator>; using element_type = typename std::iterator_traits<Iterator>::value_type;
tokeniser (cruft::view<Iterator,Iterator> _range, element_type _separator):
tokeniser (cruft::view<Iterator,Iterator> _range, value_type _separator):
m_range (_range), m_range (_range),
m_separator (_separator) m_separator (_separator)
{ ; } { ; }
@ -54,7 +53,7 @@ namespace cruft {
struct iterator : public std::iterator< struct iterator : public std::iterator<
std::forward_iterator_tag, std::forward_iterator_tag,
range_type, value_type,
std::size_t std::size_t
> { > {
public: public:
@ -100,7 +99,7 @@ namespace cruft {
} }
private: private:
iterator (range_type _range, value_type _separator): iterator (value_type _range, element_type _separator):
m_separator (_separator), m_separator (_separator),
m_range { m_range {
_range.cbegin (), _range.cbegin (),
@ -109,8 +108,8 @@ namespace cruft {
m_end (_range.cend ()) m_end (_range.cend ())
{ ; } { ; }
value_type m_separator; element_type m_separator;
range_type m_range; value_type m_range;
Iterator m_end; Iterator m_end;
friend tokeniser; friend tokeniser;
@ -143,8 +142,8 @@ namespace cruft {
} }
private: private:
const range_type m_range; const value_type m_range;
const value_type m_separator; const element_type m_separator;
}; };