Add is_*_iterator_v variable templates in C++14 and later.

This commit is contained in:
Andrey Semashev
2026-05-13 12:16:22 +03:00
parent b74b553482
commit 4dcba468e2
6 changed files with 88 additions and 2 deletions
+13 -1
View File
@@ -2,11 +2,12 @@
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/iterator/is_readable_iterator.hpp>
#include <deque>
#include <iterator>
#include <cstddef> // std::ptrdiff_t
#include <boost/config.hpp>
#include <boost/noncopyable.hpp>
#include <boost/iterator/is_readable_iterator.hpp>
struct v
{
@@ -97,5 +98,16 @@ int main()
static_assert(boost::is_readable_iterator<noncopyable_iterator>::value,
"boost::is_readable_iterator<noncopyable_iterator>::value is expected to be true.");
#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
static_assert(boost::is_readable_iterator_v<v*>,
"boost::is_readable_iterator_v<v*> is expected to be true.");
static_assert(boost::is_readable_iterator_v<v const*>,
"boost::is_readable_iterator_v<v const*> is expected to be true.");
static_assert(boost::is_readable_iterator_v<proxy_iterator>,
"boost::is_readable_iterator_v<proxy_iterator> is expected to be true.");
static_assert(!boost::is_readable_iterator_v<proxy_iterator2>,
"boost::is_readable_iterator_v<proxy_iterator2> is expected to be false.");
#endif // !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
return 0;
}