Class template ntcts_iterator creates a standard conforming forward iterator that adapts a null-terminated character type string (NTCTS) pointer into a forward iterator suitable for use as a half-open range as required by algorithms and other range-based functions.
[Note: NTCTS is defined by the C++ standard [defns.ntcts] as "a sequence of values that have character type that precede the terminating null character type value
charT()". -- end note]
namespace boost
{
template <class charT>
class ntcts_iterator
: public boost::iterator_facade<ntcts_iterator<charT>,
charT, std::forward_iterator_tag>
{
public:
ntcts_iterator() noexcept; // constructs the end iterator
ntcts_iterator(charT* begin) noexcept;
};
typedef ntcts_iterator<const char> char_iterator;
typedef ntcts_iterator<const wchar_t> wchar_iterator;
typedef ntcts_iterator<const char16_t> char16_iterator;
typedef ntcts_iterator<const char32_t> char32_iterator;
template <class charT>
ntcts_iterator<charT> begin(ntcts_iterator<charT> it);
template <class charT>
ntcts_iterator<charT> end(ntcts_iterator<charT> it);
}
ntcts_iteratorntcts_iterator satisfies the requirements of an forward iterator
([forward.iterators]).
If an iterator of type ntcts_iterator is advanced past the last
element, that iterator shall become equal to the end iterator value. The
ntcts_iterator default constructor shall create an iterator equal to the
end iterator value, and this shall be the only valid iterator for the end
condition.
The result of operator* on an end iterator is undefined
behavior. For any other iterator value a charT& is returned. The
result of operator-> on an end iterator is undefined behavior. For
any other iterator value a charT* is returned.
Two end iterators are always equal. An end iterator shall not be equal to a non-end iterator.
The above wording is based on the Standard Library's istream_iterator wording.