forked from boostorg/iterator
CXX11
This commit is contained in:
committed by
Georgy Guminov
parent
4b40364d6d
commit
054c013bba
@@ -30,13 +30,12 @@
|
||||
#include <boost/iterator/new_iterator_tests.hpp>
|
||||
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <stdlib.h>
|
||||
#ifndef BOOST_BORLANDC
|
||||
# include <boost/tuple/tuple.hpp>
|
||||
@@ -68,7 +67,7 @@ struct unsigned_assert_nonnegative
|
||||
|
||||
template <class T>
|
||||
struct assert_nonnegative
|
||||
: boost::conditional<
|
||||
: std::conditional<
|
||||
std::numeric_limits<T>::is_signed
|
||||
, signed_assert_nonnegative<T>
|
||||
, unsigned_assert_nonnegative<T>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/assign/list_of.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/iterator/zip_iterator.hpp>
|
||||
|
||||
@@ -7,15 +7,14 @@
|
||||
#include <boost/iterator/filter_iterator.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
#include <boost/iterator/new_iterator_tests.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/concept_archetype.hpp>
|
||||
#include <boost/iterator/iterator_concepts.hpp>
|
||||
#include <boost/iterator/iterator_archetypes.hpp>
|
||||
#include <boost/cstdlib.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
#include <deque>
|
||||
#include <iostream>
|
||||
|
||||
using boost::dummyT;
|
||||
|
||||
@@ -229,12 +228,12 @@ int main()
|
||||
filter_iter(one_or_four(), array, array+N)
|
||||
, dummyT(1), dummyT(4));
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(!boost::is_convertible<
|
||||
static_assert(
|
||||
!std::is_convertible<
|
||||
boost::iterator_traversal<filter_iter>::type
|
||||
, boost::random_access_traversal_tag
|
||||
>::value
|
||||
));
|
||||
>::value,
|
||||
"");
|
||||
|
||||
//# endif
|
||||
|
||||
|
||||
@@ -11,14 +11,12 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_DECLTYPE)
|
||||
// Force boost::result_of use decltype, even on compilers that don't support N3276.
|
||||
// This enables this test to also verify if the iterator works with lambdas
|
||||
// on such compilers with this config macro. Note that without the macro result_of
|
||||
// (and consequently the iterator) is guaranteed to _not_ work, so this case is not
|
||||
// worth testing anyway.
|
||||
#define BOOST_RESULT_OF_USE_DECLTYPE
|
||||
#endif
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/iterator/function_input_iterator.hpp>
|
||||
@@ -108,8 +106,6 @@ int main()
|
||||
BOOST_TEST_EQ(*it3, 54);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \
|
||||
&& defined(BOOST_RESULT_OF_USE_DECLTYPE)
|
||||
// test the iterator with lambda expressions
|
||||
int num = 42;
|
||||
auto lambda_generator = [&num] { return num++; };
|
||||
@@ -123,7 +119,6 @@ int main()
|
||||
BOOST_TEST_EQ(generated.size(), 10u);
|
||||
for(std::size_t i = 0; i != 10; ++i)
|
||||
BOOST_TEST_EQ(generated[i], static_cast<int>(42 + i));
|
||||
#endif // BOOST_NO_CXX11_LAMBDAS
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ int main()
|
||||
BOOST_TEST_EQ(n, 6);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
|
||||
{
|
||||
int n = 0;
|
||||
auto it = boost::iterators::make_function_output_iterator([&n](int x) { n -= x; });
|
||||
@@ -57,7 +56,6 @@ int main()
|
||||
|
||||
BOOST_TEST_EQ(n, -6);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__cpp_lib_concepts) && ( __cpp_lib_concepts >= 202002L )
|
||||
{
|
||||
|
||||
@@ -9,12 +9,10 @@
|
||||
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/iterator/indirect_iterator.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include "static_assert_same.hpp"
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
struct zow { };
|
||||
|
||||
@@ -40,10 +38,12 @@ int main()
|
||||
STATIC_ASSERT_SAME(Iter::pointer, int*);
|
||||
STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t);
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<Iter::iterator_category,
|
||||
std::random_access_iterator_tag>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
||||
boost::random_access_traversal_tag>::value));
|
||||
static_assert(std::is_convertible<Iter::iterator_category,
|
||||
std::random_access_iterator_tag>::value,
|
||||
"");
|
||||
static_assert(std::is_convertible<boost::iterator_traversal<Iter>::type,
|
||||
boost::random_access_traversal_tag>::value,
|
||||
"");
|
||||
}
|
||||
{
|
||||
typedef boost::indirect_iterator<int const**> Iter;
|
||||
@@ -71,10 +71,12 @@ int main()
|
||||
|
||||
STATIC_ASSERT_SAME(Iter::difference_type, std::ptrdiff_t);
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<Iter::iterator_category,
|
||||
std::random_access_iterator_tag>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
||||
boost::random_access_traversal_tag>::value));
|
||||
static_assert(std::is_convertible<Iter::iterator_category,
|
||||
std::random_access_iterator_tag>::value,
|
||||
"");
|
||||
static_assert(std::is_convertible<boost::iterator_traversal<Iter>::type,
|
||||
boost::random_access_traversal_tag>::value,
|
||||
"");
|
||||
}
|
||||
{
|
||||
typedef boost::indirect_iterator<char**, int, std::random_access_iterator_tag, long&, short> Iter;
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
//
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
#include <boost/cstdlib.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef boost::reverse_iterator<int*> rev_iter1;
|
||||
typedef boost::reverse_iterator<char*> rev_iter2;
|
||||
|
||||
return boost::is_convertible<rev_iter1, rev_iter2>::value
|
||||
return std::is_convertible<rev_iter1, rev_iter2>::value
|
||||
? boost::exit_failure : boost::exit_success;
|
||||
}
|
||||
|
||||
+36
-38
@@ -4,9 +4,7 @@
|
||||
|
||||
#include <deque>
|
||||
#include <iterator>
|
||||
#include <iostream>
|
||||
#include <cstddef> // std::ptrdiff_t
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/iterator/is_lvalue_iterator.hpp>
|
||||
|
||||
@@ -91,58 +89,58 @@ struct constant_lvalue_iterator
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<v*>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<v const*>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<std::deque<v>::iterator>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<std::deque<v>::const_iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_lvalue_iterator<std::back_insert_iterator<std::deque<v> > >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_lvalue_iterator<std::ostream_iterator<v> >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_lvalue_iterator<proxy_iterator<v> >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_lvalue_iterator<proxy_iterator<int> >::value);
|
||||
static_assert(boost::is_lvalue_iterator<v*>::value, "");
|
||||
static_assert(boost::is_lvalue_iterator<v const*>::value, "");
|
||||
static_assert(boost::is_lvalue_iterator<std::deque<v>::iterator>::value, "");
|
||||
static_assert(boost::is_lvalue_iterator<std::deque<v>::const_iterator>::value, "");
|
||||
static_assert(!boost::is_lvalue_iterator<std::back_insert_iterator<std::deque<v> > >::value, "");
|
||||
static_assert(!boost::is_lvalue_iterator<std::ostream_iterator<v> >::value, "");
|
||||
static_assert(!boost::is_lvalue_iterator<proxy_iterator<v> >::value, "");
|
||||
static_assert(!boost::is_lvalue_iterator<proxy_iterator<int> >::value, "");
|
||||
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||
BOOST_STATIC_ASSERT(!boost::is_lvalue_iterator<value_iterator>::value);
|
||||
static_assert(!boost::is_lvalue_iterator<value_iterator>::value, "");
|
||||
#endif
|
||||
// Make sure inaccessible copy constructor doesn't prevent
|
||||
// reference binding
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<noncopyable_iterator>::value);
|
||||
static_assert(boost::is_lvalue_iterator<noncopyable_iterator>::value, "");
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<lvalue_iterator<v> >::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<lvalue_iterator<int> >::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<lvalue_iterator<char*> >::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<lvalue_iterator<float> >::value);
|
||||
static_assert(boost::is_lvalue_iterator<lvalue_iterator<v> >::value, "");
|
||||
static_assert(boost::is_lvalue_iterator<lvalue_iterator<int> >::value, "");
|
||||
static_assert(boost::is_lvalue_iterator<lvalue_iterator<char*> >::value, "");
|
||||
static_assert(boost::is_lvalue_iterator<lvalue_iterator<float> >::value, "");
|
||||
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<v> >::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<int> >::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<char*> >::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<constant_lvalue_iterator<float> >::value);
|
||||
static_assert(boost::is_lvalue_iterator<constant_lvalue_iterator<v> >::value, "");
|
||||
static_assert(boost::is_lvalue_iterator<constant_lvalue_iterator<int> >::value, "");
|
||||
static_assert(boost::is_lvalue_iterator<constant_lvalue_iterator<char*> >::value, "");
|
||||
static_assert(boost::is_lvalue_iterator<constant_lvalue_iterator<float> >::value, "");
|
||||
|
||||
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<v*>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<v const*>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<std::deque<v>::iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<std::deque<v>::const_iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<std::back_insert_iterator<std::deque<v> > >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<std::ostream_iterator<v> >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<proxy_iterator<v> >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<proxy_iterator<int> >::value);
|
||||
static_assert(boost::is_non_const_lvalue_iterator<v*>::value, "");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<v const*>::value, "");
|
||||
static_assert(boost::is_non_const_lvalue_iterator<std::deque<v>::iterator>::value, "");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<std::deque<v>::const_iterator>::value, "");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<std::back_insert_iterator<std::deque<v> > >::value, "");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<std::ostream_iterator<v> >::value, "");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<proxy_iterator<v> >::value, "");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<proxy_iterator<int> >::value, "");
|
||||
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<value_iterator>::value);
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<value_iterator>::value, "");
|
||||
#endif
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<noncopyable_iterator>::value);
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<noncopyable_iterator>::value, "");
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<v> >::value);
|
||||
static_assert(boost::is_non_const_lvalue_iterator<lvalue_iterator<v> >::value, "");
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
|
||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<int> >::value);
|
||||
static_assert(boost::is_non_const_lvalue_iterator<lvalue_iterator<int> >::value, "");
|
||||
#endif
|
||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<char*> >::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<lvalue_iterator<float> >::value);
|
||||
static_assert(boost::is_non_const_lvalue_iterator<lvalue_iterator<char*> >::value, "");
|
||||
static_assert(boost::is_non_const_lvalue_iterator<lvalue_iterator<float> >::value, "");
|
||||
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<v> >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<int> >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<char*> >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<float> >::value);
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<v> >::value, "");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<int> >::value, "");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<char*> >::value, "");
|
||||
static_assert(!boost::is_non_const_lvalue_iterator<constant_lvalue_iterator<float> >::value, "");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
|
||||
#include <deque>
|
||||
#include <iterator>
|
||||
#include <iostream>
|
||||
#include <cstddef> // std::ptrdiff_t
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/iterator/is_readable_iterator.hpp>
|
||||
|
||||
@@ -78,19 +76,19 @@ struct proxy_iterator2
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<v*>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<v const*>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<std::deque<v>::iterator>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<std::deque<v>::const_iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_readable_iterator<std::back_insert_iterator<std::deque<v> > >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_readable_iterator<std::ostream_iterator<v> >::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<proxy_iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_readable_iterator<proxy_iterator2>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<value_iterator>::value);
|
||||
static_assert(boost::is_readable_iterator<v*>::value, "");
|
||||
static_assert(boost::is_readable_iterator<v const*>::value, "");
|
||||
static_assert(boost::is_readable_iterator<std::deque<v>::iterator>::value, "");
|
||||
static_assert(boost::is_readable_iterator<std::deque<v>::const_iterator>::value, "");
|
||||
static_assert(!boost::is_readable_iterator<std::back_insert_iterator<std::deque<v> > >::value, "");
|
||||
static_assert(!boost::is_readable_iterator<std::ostream_iterator<v> >::value, "");
|
||||
static_assert(boost::is_readable_iterator<proxy_iterator>::value, "");
|
||||
static_assert(!boost::is_readable_iterator<proxy_iterator2>::value, "");
|
||||
static_assert(boost::is_readable_iterator<value_iterator>::value, "");
|
||||
|
||||
// Make sure inaccessible copy constructor doesn't prevent
|
||||
// readability
|
||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<noncopyable_iterator>::value);
|
||||
static_assert(boost::is_readable_iterator<noncopyable_iterator>::value, "");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ int main()
|
||||
#if defined(__SGI_STL_PORT) \
|
||||
|| !BOOST_WORKAROUND(__GNUC__, <= 2) \
|
||||
&& !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 1)) \
|
||||
&& !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) \
|
||||
&& !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) \
|
||||
&& !BOOST_WORKAROUND(__LIBCOMO_VERSION__, BOOST_TESTED_AT(29)) \
|
||||
&& !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 1)
|
||||
{
|
||||
|
||||
@@ -209,7 +209,7 @@ main()
|
||||
test = static_assert_same<Iter1::pointer, int*>::value;
|
||||
test = static_assert_same<Iter1::difference_type, std::ptrdiff_t>::value;
|
||||
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<Iter1::iterator_category, std::random_access_iterator_tag>::value));
|
||||
static_assert(std::is_convertible<Iter1::iterator_category, std::random_access_iterator_tag>::value, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -220,9 +220,9 @@ main()
|
||||
test = static_assert_same<Iter1::reference, const int&>::value;
|
||||
|
||||
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<Iter1>::value);
|
||||
static_assert(boost::is_readable_iterator<Iter1>::value, "");
|
||||
# ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<Iter1>::value);
|
||||
static_assert(boost::is_lvalue_iterator<Iter1>::value, "");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -243,8 +243,8 @@ main()
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<BaseIter>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<Iter>::value);
|
||||
static_assert(boost::is_non_const_lvalue_iterator<BaseIter>::value, "");
|
||||
static_assert(boost::is_lvalue_iterator<Iter>::value, "");
|
||||
#endif
|
||||
|
||||
typedef modify_traversal<BaseIter, boost::incrementable_traversal_tag> IncrementableIter;
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
#include <boost/iterator/new_iterator_tests.hpp>
|
||||
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
// This is a really, really limited test so far. All we're doing
|
||||
// right now is checking that the postfix++ proxy for single-pass
|
||||
@@ -120,7 +119,7 @@ struct wrapper
|
||||
{ }
|
||||
template <class U>
|
||||
wrapper(const wrapper<U>& other,
|
||||
typename boost::enable_if< boost::is_convertible<U,T> >::type* = 0)
|
||||
typename std::enable_if< std::is_convertible<U,T>::value >::type* = 0)
|
||||
: m_x(other.m_x)
|
||||
{ }
|
||||
};
|
||||
@@ -146,7 +145,7 @@ struct iterator_with_proxy_reference
|
||||
|
||||
template <class T, class U>
|
||||
void same_type(U const&)
|
||||
{ BOOST_STATIC_ASSERT((boost::is_same<T,U>::value)); }
|
||||
{ static_assert(std::is_same<T,U>::value, ""); }
|
||||
|
||||
template <class I, class A>
|
||||
struct abstract_iterator
|
||||
|
||||
@@ -20,15 +20,13 @@
|
||||
// reference type from operator* (David Abrahams)
|
||||
// 19 Jan 2001 Initial version with iterator operators (David Abrahams)
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
#include <type_traits>
|
||||
|
||||
// A UDT for which we can specialize std::iterator_traits<element*> on
|
||||
// compilers which don't support partial specialization. There's no
|
||||
@@ -98,7 +96,7 @@ template <> struct assertion<true>
|
||||
|
||||
template <class T, class U>
|
||||
struct assert_same
|
||||
: assertion<(::boost::is_same<T,U>::value)>
|
||||
: assertion<(std::is_same<T,U>::value)>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
#include <boost/iterator/minimum_category.hpp>
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
using boost::is_same;
|
||||
using std::is_same;
|
||||
using boost::iterators::minimum_category;
|
||||
|
||||
int main(int, char*[])
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
#include <boost/iterator/permutation_iterator.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/iterator/iterator_concepts.hpp>
|
||||
#include <boost/concept/assert.hpp>
|
||||
|
||||
@@ -44,7 +43,7 @@ void permutation_test()
|
||||
const int element_range_size = 10;
|
||||
const int index_size = 7;
|
||||
|
||||
BOOST_STATIC_ASSERT(index_size <= element_range_size);
|
||||
static_assert(index_size <= element_range_size, "");
|
||||
element_range_type elements( element_range_size );
|
||||
for( element_range_type::iterator el_it = elements.begin(); el_it != elements.end(); ++el_it )
|
||||
{ *el_it = std::distance(elements.begin(), el_it); }
|
||||
|
||||
+2
-2
@@ -3,10 +3,10 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/pointee.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include "static_assert_same.hpp"
|
||||
#include <memory>
|
||||
#include <list>
|
||||
#include <type_traits>
|
||||
|
||||
template <class T, class Ref>
|
||||
struct proxy_ptr
|
||||
@@ -27,7 +27,7 @@ struct proxy_ref_ptr : proxy_ptr<T,T&>
|
||||
template <class T>
|
||||
struct proxy_value_ptr : proxy_ptr<T,T>
|
||||
{
|
||||
typedef typename boost::add_const<T>::type element_type;
|
||||
typedef typename std::add_const<T>::type element_type;
|
||||
};
|
||||
|
||||
struct X {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/range/distance.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/iterator/distance.hpp>
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ int main()
|
||||
#if defined(__SGI_STL_PORT) \
|
||||
|| !BOOST_WORKAROUND(__GNUC__, <= 2) \
|
||||
&& !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 1)) \
|
||||
&& !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) \
|
||||
&& !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) \
|
||||
&& !BOOST_WORKAROUND(__LIBCOMO_VERSION__, BOOST_TESTED_AT(29)) \
|
||||
&& !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 1)
|
||||
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
#ifndef STATIC_ASSERT_SAME_DWA2003530_HPP
|
||||
# define STATIC_ASSERT_SAME_DWA2003530_HPP
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
#define STATIC_ASSERT_SAME( T1,T2 ) BOOST_STATIC_ASSERT((::boost::is_same< T1, T2 >::value))
|
||||
#define STATIC_ASSERT_SAME( T1,T2 ) static_assert(std::is_same<T1, T2>::value, "")
|
||||
|
||||
template <class T1, class T2>
|
||||
struct static_assert_same
|
||||
|
||||
@@ -172,20 +172,20 @@ main()
|
||||
{
|
||||
{
|
||||
typedef boost::transform_iterator<adaptable_mult_functor, int*, float> iter_t;
|
||||
BOOST_STATIC_ASSERT((boost::is_same<iter_t::reference, float>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<iter_t::value_type, float>::value));
|
||||
static_assert(boost::is_same<iter_t::reference, float>::value, "");
|
||||
static_assert(boost::is_same<iter_t::value_type, float>::value, "");
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::transform_iterator<adaptable_mult_functor, int*, boost::use_default, float> iter_t;
|
||||
BOOST_STATIC_ASSERT((boost::is_same<iter_t::reference, int>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<iter_t::value_type, float>::value));
|
||||
static_assert(boost::is_same<iter_t::reference, int>::value, "");
|
||||
static_assert(boost::is_same<iter_t::value_type, float>::value, "");
|
||||
}
|
||||
|
||||
{
|
||||
typedef boost::transform_iterator<adaptable_mult_functor, int*, float, double> iter_t;
|
||||
BOOST_STATIC_ASSERT((boost::is_same<iter_t::reference, float>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<iter_t::value_type, double>::value));
|
||||
static_assert(boost::is_same<iter_t::reference, float>::value, "");
|
||||
static_assert(boost::is_same<iter_t::value_type, double>::value, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+24
-15
@@ -3,10 +3,10 @@
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include "static_assert_same.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
#include <boost/iterator/minimum_category.hpp>
|
||||
|
||||
struct X { int a; };
|
||||
@@ -38,32 +38,41 @@ void category_test()
|
||||
using namespace boost::iterators;
|
||||
using namespace boost::iterators::detail;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
!boost::is_convertible<
|
||||
static_assert(
|
||||
!std::is_convertible<
|
||||
std::input_iterator_tag
|
||||
, input_output_iterator_tag>::value));
|
||||
, input_output_iterator_tag>::value,
|
||||
"");
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
!boost::is_convertible<
|
||||
static_assert(
|
||||
!std::is_convertible<
|
||||
std::output_iterator_tag
|
||||
, input_output_iterator_tag>::value));
|
||||
, input_output_iterator_tag
|
||||
>::value,
|
||||
"");
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_convertible<
|
||||
static_assert(
|
||||
std::is_convertible<
|
||||
input_output_iterator_tag
|
||||
, std::input_iterator_tag>::value));
|
||||
, std::input_iterator_tag
|
||||
>::value,
|
||||
"");
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_convertible<
|
||||
static_assert(
|
||||
std::is_convertible<
|
||||
input_output_iterator_tag
|
||||
, std::output_iterator_tag>::value));
|
||||
, std::output_iterator_tag
|
||||
>::value,
|
||||
"");
|
||||
|
||||
#if 0 // This seems wrong; we're not advertising
|
||||
// input_output_iterator_tag are we?
|
||||
BOOST_STATIC_ASSERT((
|
||||
static_assert(
|
||||
boost::is_convertible<
|
||||
std::forward_iterator_tag
|
||||
, input_output_iterator_tag>::value));
|
||||
, input_output_iterator_tag
|
||||
>::value,
|
||||
"");
|
||||
#endif
|
||||
|
||||
int test = static_assert_min_cat<
|
||||
|
||||
Reference in New Issue
Block a user