From 1ab474b8533f2f1feb304496fc0ae44c1c3d293d Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Fri, 25 Apr 2003 15:18:49 +0000 Subject: [PATCH] Bug fix and associated unit tests [SVN r1185] --- include/boost/iterator/iterator_facade.hpp | 2 +- test/Jamfile | 1 + test/unit_tests.cpp | 36 ++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 test/unit_tests.cpp diff --git a/include/boost/iterator/iterator_facade.hpp b/include/boost/iterator/iterator_facade.hpp index 5b72414..6981056 100644 --- a/include/boost/iterator/iterator_facade.hpp +++ b/include/boost/iterator/iterator_facade.hpp @@ -124,8 +124,8 @@ namespace boost readable_lvalue_iterator_tag , typename access_category_tag::type > - , operator_arrow_proxy , Pointer + , operator_arrow_proxy > { }; diff --git a/test/Jamfile b/test/Jamfile index 2f3de81..479715a 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -1,5 +1,6 @@ SEARCH on testing.jam = $(BOOST_BUILD_PATH) ; include testing.jam ; +run unit_tests.cpp ; run concept_tests.cpp ; run iterator_adaptor_cc.cpp ; run iterator_adaptor_test.cpp ; diff --git a/test/unit_tests.cpp b/test/unit_tests.cpp new file mode 100755 index 0000000..d06b769 --- /dev/null +++ b/test/unit_tests.cpp @@ -0,0 +1,36 @@ +// Copyright David Abrahams 2003. 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. +#include + +struct X { int a; }; + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace boost { namespace detail { +template<> struct iterator_traits + : ptr_iter_traits {}; +}} +#endif + +struct Xiter : boost::iterator_adaptor +{ + Xiter(); + Xiter(X* p) : boost::iterator_adaptor(p) {} +}; + +void take_xptr(X*) {} +void operator_arrow_test() +{ + // check that the operator-> result is a pointer for lvalue iterators + X x; + take_xptr(Xiter(&x).operator->()); +} + +int main() +{ + operator_arrow_test(); + return 0; +} +