mirror of
https://github.com/boostorg/iterator.git
synced 2026-06-11 19:51:18 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4dcba468e2 |
@@ -139,10 +139,19 @@ struct is_iterator< volatile T > : public detail::is_iterator_impl< T >::type {}
|
||||
template< typename T >
|
||||
struct is_iterator< const volatile T > : public detail::is_iterator_impl< T >::type {};
|
||||
|
||||
#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
template< typename T >
|
||||
BOOST_INLINE_VARIABLE constexpr bool is_iterator_v = iterators::is_iterator< T >::value;
|
||||
#endif // !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
using iterators::is_iterator;
|
||||
|
||||
#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
using iterators::is_iterator_v;
|
||||
#endif // !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ITERATOR_IS_ITERATOR_HPP_INCLUDED_
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#ifndef IS_LVALUE_ITERATOR_DWA2003112_HPP
|
||||
#define IS_LVALUE_ITERATOR_DWA2003112_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/iterator/detail/type_traits/conjunction.hpp>
|
||||
|
||||
#include <iterator>
|
||||
@@ -71,11 +72,23 @@ struct is_non_const_lvalue_iterator :
|
||||
{
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
template< typename T >
|
||||
BOOST_INLINE_VARIABLE constexpr bool is_lvalue_iterator_v = iterators::is_lvalue_iterator< T >::value;
|
||||
template< typename T >
|
||||
BOOST_INLINE_VARIABLE constexpr bool is_non_const_lvalue_iterator_v = iterators::is_non_const_lvalue_iterator< T >::value;
|
||||
#endif // !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
using iterators::is_lvalue_iterator;
|
||||
using iterators::is_non_const_lvalue_iterator;
|
||||
|
||||
#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
using iterators::is_lvalue_iterator_v;
|
||||
using iterators::is_non_const_lvalue_iterator_v;
|
||||
#endif // !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // IS_LVALUE_ITERATOR_DWA2003112_HPP
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace iterators {
|
||||
@@ -60,10 +61,19 @@ struct is_readable_iterator :
|
||||
{
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
template< typename T >
|
||||
BOOST_INLINE_VARIABLE constexpr bool is_readable_iterator_v = iterators::is_readable_iterator< T >::value;
|
||||
#endif // !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
using iterators::is_readable_iterator;
|
||||
|
||||
#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
using iterators::is_readable_iterator_v;
|
||||
#endif // !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // IS_READABLE_ITERATOR_DWA2003112_HPP
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
@@ -160,5 +161,25 @@ int main()
|
||||
BOOST_TEST(!boost::iterators::is_iterator< int (&)(int) >::value);
|
||||
BOOST_TEST(!boost::iterators::is_iterator< int (&)[10] >::value);
|
||||
|
||||
#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
BOOST_TEST(boost::iterators::is_iterator_v< int* >);
|
||||
BOOST_TEST(boost::iterators::is_iterator_v< const int* >);
|
||||
BOOST_TEST(boost::iterators::is_iterator_v< complete* >);
|
||||
BOOST_TEST(boost::iterators::is_iterator_v< std::reverse_iterator< int* > >);
|
||||
BOOST_TEST(boost::iterators::is_iterator_v< std::reverse_iterator< complete* > >);
|
||||
BOOST_TEST(boost::iterators::is_iterator_v< adapted_iterator< int* > >);
|
||||
|
||||
BOOST_TEST(!boost::iterators::is_iterator_v< int >);
|
||||
BOOST_TEST(!boost::iterators::is_iterator_v< void* >);
|
||||
BOOST_TEST(!boost::iterators::is_iterator_v< int (int) >);
|
||||
BOOST_TEST(!boost::iterators::is_iterator_v< int (*)(int) >);
|
||||
BOOST_TEST(!boost::iterators::is_iterator_v< int complete::* >);
|
||||
BOOST_TEST(!boost::iterators::is_iterator_v< int (complete::*)(int) >);
|
||||
BOOST_TEST(!boost::iterators::is_iterator_v< int*[] >);
|
||||
BOOST_TEST(!boost::iterators::is_iterator_v< int*[10] >);
|
||||
BOOST_TEST(!boost::iterators::is_iterator_v< int& >);
|
||||
BOOST_TEST(!boost::iterators::is_iterator_v< int*& >);
|
||||
#endif // !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -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_lvalue_iterator.hpp>
|
||||
#include <deque>
|
||||
#include <iterator>
|
||||
#include <cstddef> // std::ptrdiff_t
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/iterator/is_lvalue_iterator.hpp>
|
||||
|
||||
struct v
|
||||
{
|
||||
@@ -168,5 +169,25 @@ int main()
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<float>>::value,
|
||||
"boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<float>>::value is expected to be false.");
|
||||
|
||||
#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
static_assert(boost::is_lvalue_iterator_v<v*>,
|
||||
"boost::is_lvalue_iterator_v<v*> is expected to be true.");
|
||||
static_assert(boost::is_lvalue_iterator_v<v const*>,
|
||||
"boost::is_lvalue_iterator_v<v const*> is expected to be true.");
|
||||
static_assert(!boost::is_lvalue_iterator_v<proxy_iterator<int>>,
|
||||
"boost::is_lvalue_iterator_v<proxy_iterator<int>> is expected to be false.");
|
||||
static_assert(!boost::is_lvalue_iterator_v<value_iterator>,
|
||||
"boost::is_lvalue_iterator_v<value_iterator> is expected to be false.");
|
||||
|
||||
static_assert(boost::is_non_const_lvalue_iterator_v<v*>,
|
||||
"boost::is_non_const_lvalue_iterator_v<v*> is expected to be true.");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator_v<v const*>,
|
||||
"boost::is_non_const_lvalue_iterator_v<v const*> is expected to be false.");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator_v<proxy_iterator<int>>,
|
||||
"boost::is_non_const_lvalue_iterator_v<proxy_iterator<int>> is expected to be false.");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator_v<value_iterator>,
|
||||
"boost::is_non_const_lvalue_iterator_v<value_iterator> is expected to be false.");
|
||||
#endif // !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user