diff --git a/iterator_traits_test.cpp b/iterator_traits_test.cpp index 1935b06..04c1299 100644 --- a/iterator_traits_test.cpp +++ b/iterator_traits_test.cpp @@ -86,34 +86,43 @@ struct my_iterator3 : my_iterator1 : my_iterator1(p) {} }; -template struct assertion; -template <> struct assertion { typedef char type; }; +// +// Assertion tools. Used instead of BOOST_STATIC_ASSERT because that +// doesn't give us a nice stack backtrace +// +template struct assertion; +template <> struct assertion +{ + typedef char type; +}; + +template +struct assert_same + : assertion<(::boost::is_same::value)> +{ +}; + + +// Iterator tests template struct non_portable_tests { typedef typename boost::detail::iterator_traits::pointer test_pt; typedef typename boost::detail::iterator_traits::reference test_rt; - - non_portable_tests() - { - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); - } + typedef typename assert_same::type a1; + typedef typename assert_same::type a2; }; template struct portable_tests { - portable_tests() - { - typedef typename boost::detail::iterator_traits::difference_type test_dt; - typedef typename boost::detail::iterator_traits::iterator_category test_cat; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); - } + typedef typename boost::detail::iterator_traits::difference_type test_dt; + typedef typename boost::detail::iterator_traits::iterator_category test_cat; + typedef typename assert_same::type a1; + typedef typename assert_same::type a2; }; // Test iterator_traits @@ -122,15 +131,8 @@ template { - input_iterator_test() - { - typedef typename boost::detail::iterator_traits::value_type test_vt; - BOOST_STATIC_ASSERT(( - ::boost::is_same< - test_vt, - value_type - >::value)); - } + typedef typename boost::detail::iterator_traits::value_type test_vt; + typedef typename assert_same::type a1; }; template my_iterator2_test; - + non_pointer_test my_iterator3_test;