diff --git a/test/indirect_iterator_member_types.cpp b/test/indirect_iterator_member_types.cpp new file mode 100644 index 0000000..ffc15be --- /dev/null +++ b/test/indirect_iterator_member_types.cpp @@ -0,0 +1,112 @@ +// (C) Copyright Jeremy Siek 2004. Permission to copy, use, modify, +// sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. + +// Revision History +// 03 Jan 2004 Jeremy Siek +// First draft. + + +#include +#include + +#include +#include +#include + +struct none { }; +void blah(none) { } + +struct zow { }; + +struct my_ptr1 { + typedef const volatile zow element_type; +}; + +struct my_ptr2 { }; +namespace boost { + template <> struct referent { + typedef const volatile zow type; + }; +} + +int main() +{ + { + typedef boost::indirect_iterator< + int**, + /* Value = */ boost::use_default, + /* Category = */ boost::use_default, + /* Reference = */ boost::use_default, + /* Difference = */ boost::use_default> Iter; + + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + + BOOST_STATIC_ASSERT((boost::is_convertible::value)); + BOOST_STATIC_ASSERT((boost::is_convertible::type, + boost::random_access_traversal_tag>::value)); + } + { + typedef boost::indirect_iterator< + my_ptr1*, + /* Value = */ boost::use_default, + /* Category = */ boost::use_default, + /* Reference = */ boost::use_default, + /* Difference = */ boost::use_default> Iter; + + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + + BOOST_STATIC_ASSERT((boost::is_convertible::value)); + BOOST_STATIC_ASSERT((boost::is_convertible::type, + boost::random_access_traversal_tag>::value)); + } +#if 0 + // This is a bug. + { + typedef boost::indirect_iterator< + my_ptr2*, + /* Value = */ boost::use_default, + /* Category = */ boost::use_default, + /* Reference = */ boost::use_default, + /* Difference = */ boost::use_default> Iter; + + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + + BOOST_STATIC_ASSERT((boost::is_convertible::value)); + BOOST_STATIC_ASSERT((boost::is_convertible::type, + boost::random_access_traversal_tag>::value)); + } +#endif + { + typedef boost::indirect_iterator< + int**, + const volatile int, + /* Category = */ boost::use_default, + /* Reference = */ boost::use_default, + /* Difference = */ boost::use_default> Iter; + + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + BOOST_STATIC_ASSERT((boost::is_same::value)); + + BOOST_STATIC_ASSERT((boost::is_convertible::value)); + BOOST_STATIC_ASSERT((boost::is_convertible::type, + boost::random_access_traversal_tag>::value)); + } +}