Works with MSVC and Intel5 now. Thanks, Aleksey!!

[SVN r16165]
This commit is contained in:
Dave Abrahams
2002-11-08 17:08:17 +00:00
parent 9655beb7ba
commit 252c02aca0

View File

@@ -86,34 +86,43 @@ struct my_iterator3 : my_iterator1
: my_iterator1(p) {} : my_iterator1(p) {}
}; };
template <bool> struct assertion; //
template <> struct assertion<true> { typedef char type; }; // Assertion tools. Used instead of BOOST_STATIC_ASSERT because that
// doesn't give us a nice stack backtrace
//
template <bool = false> struct assertion;
template <> struct assertion<true>
{
typedef char type;
};
template <class T, class U>
struct assert_same
: assertion<(::boost::is_same<T,U>::value)>
{
};
// Iterator tests
template <class Iterator, template <class Iterator,
class value_type, class difference_type, class pointer, class reference, class category> class value_type, class difference_type, class pointer, class reference, class category>
struct non_portable_tests struct non_portable_tests
{ {
typedef typename boost::detail::iterator_traits<Iterator>::pointer test_pt; typedef typename boost::detail::iterator_traits<Iterator>::pointer test_pt;
typedef typename boost::detail::iterator_traits<Iterator>::reference test_rt; typedef typename boost::detail::iterator_traits<Iterator>::reference test_rt;
typedef typename assert_same<test_pt, pointer>::type a1;
non_portable_tests() typedef typename assert_same<test_rt, reference>::type a2;
{
BOOST_STATIC_ASSERT((::boost::is_same<test_pt, pointer>::value));
BOOST_STATIC_ASSERT((::boost::is_same<test_rt, reference>::value));
}
}; };
template <class Iterator, template <class Iterator,
class value_type, class difference_type, class pointer, class reference, class category> class value_type, class difference_type, class pointer, class reference, class category>
struct portable_tests struct portable_tests
{ {
portable_tests() typedef typename boost::detail::iterator_traits<Iterator>::difference_type test_dt;
{ typedef typename boost::detail::iterator_traits<Iterator>::iterator_category test_cat;
typedef typename boost::detail::iterator_traits<Iterator>::difference_type test_dt; typedef typename assert_same<test_dt, difference_type>::type a1;
typedef typename boost::detail::iterator_traits<Iterator>::iterator_category test_cat; typedef typename assert_same<test_cat, category>::type a2;
BOOST_STATIC_ASSERT((::boost::is_same<test_dt, difference_type>::value));
BOOST_STATIC_ASSERT((::boost::is_same<test_cat, category>::value));
}
}; };
// Test iterator_traits // Test iterator_traits
@@ -122,15 +131,8 @@ template <class Iterator,
struct input_iterator_test struct input_iterator_test
: portable_tests<Iterator,value_type,difference_type,pointer,reference,category> : portable_tests<Iterator,value_type,difference_type,pointer,reference,category>
{ {
input_iterator_test() typedef typename boost::detail::iterator_traits<Iterator>::value_type test_vt;
{ typedef typename assert_same<test_vt, value_type>::type a1;
typedef typename boost::detail::iterator_traits<Iterator>::value_type test_vt;
BOOST_STATIC_ASSERT((
::boost::is_same<
test_vt,
value_type
>::value));
}
}; };
template <class Iterator, template <class Iterator,
@@ -189,7 +191,7 @@ non_pointer_test<my_iterator1, char, long, const char*, const char&, std::forwar
non_pointer_test<my_iterator2, char, long, const char*, const char&, std::forward_iterator_tag> non_pointer_test<my_iterator2, char, long, const char*, const char&, std::forward_iterator_tag>
my_iterator2_test; my_iterator2_test;
non_pointer_test<my_iterator3, char, int, const char*, const char&, std::forward_iterator_tag> non_pointer_test<my_iterator3, char, int, const char*, const char&, std::forward_iterator_tag>
my_iterator3_test; my_iterator3_test;